qt

Creating a QThread event loop in an existing non QT thread

My code is a plugin of a host software which gets limited processing time. Therefore, I create a second thread (via system API) and start QApplication there. That way, the GUI runs smoothly. Now, I would like to run a QThread event loop in the original such that I could use Signal/Slot (Qt::QueuedConnection) to invoke functions that are...

HowTo restore QTreeView last expanded state?

Hi. What I have: QTreeView class with table data And connected QAbstractTableModel model Question: how to save expanded state of items? Is some one have finished solutions? PS: I know, that I can do this code by myself, but I don't have much time, and this is not the major problem of our project, but still we need it, because app ...

how to use CTelephony API with QT Symbian

Hi, i want to use CTelephony API in QT Symbian project but after including etel3rdparty.h and etel3rdparty.lib as library and header in .pro file like this: LIBS += C:/NokiaQtSDK/Symbian/SDK/epoc32/release/armv5/lib/etel3rdparty.lib INCLUDEPATH += C:/NokiaQtSDK/Symbian/SDK/epoc32/include i am getting a lot of compilation errors. Plea...

Appending pointers to QList

I need to insert pointers of classes (inherited from QObject) into a QList. I know that the following syntax can be used: .h QList<MyObject*> list; .cpp list.append(new MyObject("first", 1)); list.append(new MyObject("second", 2)); ... and then free memory: if(!list.isEmpty()) { qDeleteAll(list); list.clear(); } This sh...

Several ways of placing an image in a QTextEdit.

I think this is a very simple question, but when I copy an image I can't paste it in a QTextEdit? Paste is inactive! Also I would like to know how to drag-and-drop a picture. BTW I use the following code in order to insert a picture into a QTextEdit: QTextEdit *textEditor = new QTextEdit(0); QTextDocumentFragment fragment; fragment = Q...

How to implement QTextDocument serialization

This question I have asked before and just got answer that there is an open bug for this. But this is a really required feature and, I guess, each Qt programmer who programmes a more or less serious application, it is quite probable that there is used a QTextEdit and the data is inserted in QTextEdit is serialized and deserialized. Thus ...

[QT/C++]Creating objects of class through its name stored in a string?

Can I create an object of a class at runtime, by extracting the class name stored in a string? eg: I want to create and object of class QButton like QString strClassName = "QButton"; QButton *pBtn = new strClassName(); I want to read an xml file of all the controls and instantiate them at runtime using this way. Thanks! ...

How to parse an XML string in Qt

I am developing an application in that after making a web service I got the response from the server which is in the XML tag. The response: <?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n <string...... /\">Hello World</string> I want to read only the "Hello World" string. How should I parse it? ...

how to obtain contact list in qt

i use this code and getting contact details of only one person .... contactManager = new QContactManager(); QList<QContact> contacts = contactManager->contacts(); contacts.detail(QContactPhoneNumber::DefinitionName).value(QContactPhoneNumber::FieldNumber); QContact a = contactManager->contact(contacts.count()); QContactPhoneNumber no =...

Problem With Python Bindings on a Widget That uses GStreamer

First, some background information: I'm currently developing a program for the Nokia N900 using Python and PyQt4. The program accesses the phone's camera. I have figured out how to use GStreamer in a Qt widget to capture the video. It turns out that I need access to a somewhat obscure gstreamer interface which I don't believe I can ac...

how to get number of the current position of the cursor (qt)

hello everybody, I need small help, I'm using class Qslider from qt, how can I get the number of the current position of the cursor (with which function I can do that) thanks in advance edited I want to implement one thing: when I reach the max of the interval I want to quit, how can I do this with slot and signal? ...

qt specific implementation

hello, I have this snippet of the code: #include <QApplication> #include <QFont> #include <QLCDNumber> #include <QPushButton> #include <QSlider> #include <QVBoxLayout> #include <QWidget> class MyWidget : public QWidget { public: MyWidget(QWidget *parent = 0); }; MyWidget::MyWidget(QWidget *parent) : QWidget(parent...

Qt Creator problem. UI changes not showing when project is built.

I'm making changes to a form in Creator but when I build the changes are not being "refreshed". I've gone so far as to remove every element from the form and get rid of every stylesheet but when I build the project I get the same result; as if I had never made a change at all. What gives? Am I missing something obvious? (obvious to every...

Using Qt signals and slots with multiple inheritance

I have a class (MyClass) that inherits most of its functionality from a Qt built-in object (QGraphicsTextItem). QGraphicsTextItem inherits indirectly from QObject. MyClass also implements an interface, MyInterface. class MyClass : public QGraphicsTextItem, public MyInterface I need to be able to use connect and disconnect on MyInterfa...

difference between connections in qt

I have some constructor for the class LCDRange: LCDRange::LCDRange(QWidget *parent) : QWidget(parent) { QLCDNumber *lcd = new QLCDNumber(2); lcd->setSegmentStyle(QLCDNumber::Filled); slider = new QSlider(Qt::Horizontal); slider->setRange(0, 99); slider->setValue(0); connect(slider, SIGNAL(valueChan...

Calling command prompt from Qt application without freezing?

Hello, In my Qt GUI application, I am calling the command prompt through: system("lots.exe & of.exe && commands.exe"); It opens up the command prompt (like I want it to), but freezes the Qt GUI application until I close the command prompt. Is there someway to prevent this? I saw that there is a QProcess class, but can't get it to br...

How to make QDialogButtonBox NOT close its parent QDialog?

I have a QDialog with a QDialogButtonBox widget, and I've connected the button box's accepted signal to a slot in my QDialog subclass, like so: void MyDialog::on_buttonBox_accepted() { QString errorString = this->inputErrorString(); if (errorString.isEmpty()) { // Do work here // code code code... th...

What is MINGWDIR?

Hello. While building Qt and Qt-based software on windows, it seems important to set MINGWDIR environment variable. But i'm not very pleased with doing something like 'voodoo magic', without knowing the reasons. Unfortunately, searching google reveals that it's a lot of tutorials and examples that sets MINGWDIR, but no documentation abo...

Q_OBJECT linker error!!

Hi, I am receiving the following linker error when I build my application. HIMyClass.obj:: error: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall CHIMyClass::metaObject(void)const " (?metaObject@CHIMyClass@@UBEPBUQMetaObject@@XZ) File not found : HIMyClass.obj HIMyClass.obj:: error...

Lifetime of Qt Objects

What are the lifetimes of Qt Objects? Such as: QTcpSocket *socket=new QTcpSocket(); When socket will be destroyed? Should I use delete socket; Is there any difference with: QTcpSocket socket; I couldn't find deep infromation about this, any comment or link is welcomed. ...