qt4

How to install and handle the event filter to Qt graphicsview

Hi, i have a graphicsview and graphicsscen but i don't no how to install and handle the event filter for getting the keyboard events. i appreciate your help regarding the same. Thanks in advance. ...

Is emitting a disconnected signal bad?

I defined a signal in myapp and emit it in very different places within code, but I need it just when my MY_DEFINED_FLAG is defined, my question is: Do I should change every: emit mySignal(); to #ifdef MY_DEFINED_FLAG emit mySignal(); #endif ? and if the answer is "yes" then, is there a better idea? ...

How can I add the QtSql library in Qt creater?

when I compile the codes which has database connection, there's an error like, QtSql: No such file or directory I suppose that the sql library must be in Qt, but I dont have any idea why an error occured ? what to do for enable the database's libraries? Can you help me please, thanks ...

setting button focus in graphcisview

HI, I have placed few button in Qgraphicsscene, but I don’t know how to navigate the button from keyboard. I don’t know how to set the focus to button. Can anyone provide me the idea about how to do that ...

Remove a list of selected items in the QListView

Hi. How can I remove a list of selected items in the QListView in QT 4.6. Something like this does not work, the iterator becomes invalid: QModelIndexList indexes = ui.listview_files->selectionModel()->selectedIndexes(); foreach(QModelIndex index, indexes) { model->removeRow(index.row()); } removeRows also not suitable, it...

Qt QLineEdit custom validation in ruby

I am trying to imple QLineEdit's text which is all capital letters no matter what user types in. I have found several solutions, none of them working in Ruby. In brief I have QLineEdit object searchEdit and this code: class UpcaseValidator < Qt::Validator def validate(input,pos) input.upcase! Qt::Validator::Acceptable e...

How to overwrite the "next" slot in a QWizard ??

Hi: I'm using a QWizard class, which contains several QWizardPage. For some pages, I need to do something when "Next" button is clicked. I tried to overwrite the "next" slot in QWizard class, however, it seems this doesn't work. the program still went into the original "next" slot in QWizard class instead the one I implemented. Does th...

Very big QImage and Memory Mapped Files in QT

I want bind QImage to the MMF file to manipulate the image without the cost of memory directly on the disc. Unfortunately, my code creates a copy in memory. QFile file("Boston City Flow.jpg"); if(!file.open(QIODevice::ReadOnly)) QMessageBox::information(this, "Error", "Error"); qint64 size = file.size(); unsigned char *mmf = fil...

In Qt how can i start application without using GUI

Im using QT for screen printing using : QPixmap::grabWindow(QApplication::desktop()->winId()) i like the application to be hidden or at list be console none GUI application how can i do that in Qt? ...

Customize the buttons in a QWIzard??

QWizard have some options related to the buttons as follows: NoDefaultButton NoBackButtonOnStartPage NoBackButtonOnLastPage DisabledBackButtonOnLastPage HaveNextButtonOnLastPage HaveFinishButtonOnEarlyPages NoCancelButton CancelButtonOnLeft HaveHelpButton HelpButtonOnRight Now these options are ...

How to customize a listview in Qt

I want to customize a listview in Qt, can anyone provide me some example or hints of how to do it? I am new to Qt. ...

How to know that widget is currently is running in Qt Designer

How can I in code of the custom Qt widget know that it is currently instantiated in Qt designer? Use case: I build a complex custom widget that has several child widgets like QPushButton, QLabel etc. As application logic require, when widget is created most of those sub component are not visible but in design time when I put it on a ...

What's difference between class QWebView; vs. #include <QWebView>

What's difference between these defining; #include "QWebView" class QWebView; ...

İs it important to declare the namespace with QT_BEGIN_NAMESPACE .. QT_END_NAMESPACE

What is the effect of QT_BEGIN_NAMESPACE? QT_BEGIN_NAMESPACE class QLineEdit; QT_END_NAMESPACE If I dont use the class declaration like that, is there any problem occure? ...

Subsequent insertion of records with QSqlTableRecord fail after first error

Hi, I have a problem with inserting data into SQLite database using QSqlTableModel. The table is created like this: QSqlQuery createTblSMS("CREATE TABLE sms_tbl(" "isRead BOOLEAN NOT NULL," "readTime DATETIME," "arrivalTime DATETIME NOT NULL," "sender TEXT NOT NULL," "receiver TEXT NOT NULL," ...

Help Integration in Qt/C++ Application

Hi, I am using Qt 4.6 so do C++. I have a User Manual (.chm) for my application which has the help required for the users to run the application. Now I want this help to be integrated into my application, so that when the user selects for help from the application, the user manual will be opened with the corresponding help page displ...

Can the QPropertyAnimation update interval be increased for ultra-smooth animation?

The new Animation Framework in Qt 4.6+ is based on QTimeLine which has 'void setUpdateInterval(int interval)' public function. Based on QTimeLine as well, QGraphicsItemAnimation could access this function, but the new animation framework classes (e.g. QPropertyAnimation) can't! Is the animation framework locked to the about 60 updates pe...

Console output in a Qt GUI app?

I have a Qt GUI application running on Windows that allows command-line options to be passed and under some circumstances I want to output a message to the console and then quit, for example: int main(int argc, char *argv[]) { QApplication a(argc, argv); if (someCommandLineParam) { std::cout << "Hello, world!"; return 0; ...

How can I access the data from javascript by Qt?

I used webview to show the webpage, view->setUrl(QUrl("C:\\Qt\\2010.07\\qt\\serbest\\googleSearch.htm")); in the HTML code I put some ajax code googleSearch. After I execute the program, the webview runs and there are results (pages links). When I clicked any of the links they do not open. So what do I do to open the links I clicked...

Qt QTableView how to have a checkbox only column

We are using a QTableView with Qt 4.6.3, and need a column that only has a checkbox in each cell. We're using a custom subclass of QAbstractTableModel as the model for the QTableView. Right now, we have a checkbox by setting the Qt::ItemIsUserCheckable flag. But we can't figure out how to get rid of the blank textbox next to the check...