qt

How to get number of bytes read from QTextStream

The following code I am using to find the number of read bytes from QFile. With some files it gives the correct file size, but with some files it gives me a value that is approximatively fileCSV.size()/2. I am sending two files that have same number of characters in it, but have different file sizes link text. Should i use some other obj...

what property should i set to Fit the text in label

Hi, i want to display a big string in Qlablel for this simply i have created a label in Qt GUI editor, then i put the string, with the Wordwrap property ON. here text is not coming to the next line itself, instead its crossing the view region. but if i give "\n" it works well. how to put up big string in label, to display in visible r...

Does Qt support virtual pure slots ?

Hi, My GUI project in Qt has a lot of "configuration pages" classes which all inherit directly from QWidget. Recently, I realized that all these classes share 2 commons slots (loadSettings() and saveSettings()). Regarding this, I have two questions: Does it make sense to write a intermediate base abstract class (lets name it BaseCon...

Compiling Qt for Windows 98

I need to support Windows 98. The Qt documentation claims this is possible, but there are no instructions. The distributed binaries of Qt 4.6 don't run on Win98 and the majority of Qt applications I have sampled also don't. For several apps that do run on 98, I have asked authors how they did it, but the common answer is that it was acci...

Serializing QGraphicsScene contents

I am using the Qt QGraphicsScene class, adding pre-defined items such as QGraphicsRectItem, QGraphicsLineItem, etc. and I want to serialize the scene contents to disk. However, the base QGraphicsItem class (that the other items I use derive from) doesn't support serialization so I need to roll my own code. The problem is that all acces...

Why won't my breakpoints work in QT-Creator

QT creator can build and run my projects perfectly, but it will skip straight over any breakpoints I set. I can't find any options to fix this, and I'd appreciate some help. EDIT: The SDK is built in debug mode, and the project build configuration is set to debug. ...

C++/Qt - Memory allocation question

Hello! I recently started investigating Qt for myself and have the following question: Suppose I have some QTreeWidget* widget. At some moment I want to add some items to it and this is done via the following call: QList<QTreeWidgetItem*> items; // Prepare the items QTreeWidgetItem* item1 = new QTreeWidgetItem(...); QTreeWidgetItem* ...

Qt moc with implementations inside of header files?

Is it possible to tell the Qt MOC that I would like to declare the class and implement it in a single file rather than splitting them up into an .h and .cpp file? ...

QSystemTrayIcon does not show message

I'm trying to use QSystemTrayIcon to display a message after application initialization. My main loop immediately calls Init() function by using a single-shot timer with zero period: int r; QTimer::singleShot(0, &app, SLOT(Init())); r = app.exec(); return r; After some initialization steps, and the creation of trayIcon in MyApplicatio...

QT Question (general math really): How can I tell if an Ellipse and a Line have an intersection?

The ellipse is actually a circle. I know all the coordinates of both things, I just need to know whether or not a line goes through an ellipse. Is this built in anywhere? SPecifically I am using QGraphicsEllipseIem and QLine but i can convert them to any other type thanks ...

What event (if any) does QTextEdit fire when the size of its content changes?

As the title says, how can I receive notification whenever a multi-line QTextEdit changes the size of its content? (Note: *content size* is different from the control size, i.e. I want to know when lines were added or removed, or changed height because of a font change). ...

How to process signals in a Qt subclass?

How do I process a signal of in a subclass? Let's say my subclass is derived from QTextEdit and is interested in the signal textChanged. It seems silly to connect an object to itself, I should be able to simply override the textChange method -- but it isn't virtual. What is the accepted way to do this? ...

MySql Driver not loaded

I use Visual Studio 2008, MySQL 5.0.90,Qt 4.6.3 and C++ I try connect MySql but it gives this error messages. Driver not loaded. I am new programmer. How cann I solve this problem? Thank a lot. ...

How can I position QDockWidgets as the screen shot shows using code?

I want a Qt window to come up with the following arrangement of dock widgets on the right. Qt allows you to provide an argument to the addDockWidget method of QMainWindow to specify the position (top, bottom, left or right) but apparently not how two QDockWidgets placed on the same side will be arranged. Here is the code that adds th...

Should I use Qt signal/slot mechanisms over traditional callbacks?

A senior developer in my team used traditional C-style callbacks in our Qt application instead of using Qt signal/slot mechanisms. My first reflex would be to replace his code and use Qt signal/slot instead. Is there any good reasons to use callbacks in a Qt application/library? Thanks. ...

Using Qt to read and parse html files with QWebKit?

I would like to read and parse certain elements of html files but I'm not interested in rendering it in any way. Basically I would like to go through all my div tags and get some of its style attributes. This is what I've done so far: QWebPage page; QWebFrame * frame = page.mainFrame(); QUrl fileUrl("localFile.html"); frame->setUrl(fil...

Is there an existing template for a new C++ Open Source project

I want to start a new C++ (Qt) Open Source project and I'm wondering if there is an existing template somewhere for files usually found in an Open Source project but that are not purely source code (README, LICENSE, CHANGELOG, etc.) I could probably find a popular Open Source project for inspiration but if there is some existing generi...

Problem with signals and slots

Using Qt Creator, I am creating a class with custom slots in Qt: class CustomEdit : public QTextEdit { Q_OBJECT public: CustomEdit(QWidget* parent); public slots: void onTextChanged (); }; However, I'm getting thise linker error: undefined reference to 'vtable for CustomEdit' The documentation says: if you get ...

Why is my slot not being called?

I have this class: class CustomEdit : public QTextEdit { Q_GADGET public: CustomEdit(QWidget* parent); public slots: void onTextChanged (); }; CustomEdit::CustomEdit(QWidget* parent) : QTextEdit(parent) { connect( this, SIGNAL(textChanged()), this, SLOT(onTextChanged())); } void CustomEdit::onTextChanged (...

Replacement compiler for Qt Creator?

I like Qt Creator as an IDE, but the built-in compiler is slower than dirt. Can I replace it, and if so, with what? Developing on Windows but targeting multiple Mac as well. ...