qt

In Qt, create a table with an blank editable row

This is a Qt-specific question. It's convenient to be able to add new data to a table by typing content into a blank row at the bottom of a table. When the data is committed, a new blank row is added to the table. Has anyone found a way of implementing this in a generic way, that fits into Qt's model-view programming architecture? My c...

Pointer to a Qt Slot

Hi, i want to build a pointer to a Qt Slot: union { void (*set_slot)(unsigned long value); void (*refresh_slot)(void); } the_slot; The slot definition is: void set_pwm(unsigned long new_pwm); I try to do something like this: the_slot.set_slot = set_pwm; But the compiler says that the signature does not match: error:...

How to allow scaling with uniform aspect ratio in (Py)Qt?

If you have a QImage wrapped inside a QLabel, is it possible to scale it up or down when you resize the window and maintain the aspect ratio (so the image doesn't become distorted)? I figured out that it can scale using setScaledContents(), and you can set a minimum and maximum size, but the image still loses its aspect. It would be gr...

Jailing user to GUI program in linux

Hello! I have a project to create a program, which prevents the user from escaping a GUI program. The program is designed for students to take exams in. The program contains a web browser page. I have looked around and asked in different places how I should do this, and I have been recommended Qt. I am now having second thoughts about ...

How do I connect a pair of clients together via a server for an online game?

I'm developing a multi-player game and I know nothing about how to connect from one client to another via a server. Where do I start? Are there any whizzy open source projects which provide the communication framework into which I can drop my message data or do I have to write a load of complicated multi-threaded sockety code? Does th...

Handling a QTextEdit from another form

So the question is how to set a value of textEdit from another form? P.S. Sorry for my English. ...

Standard notifications or alert styles in Symbian (Qt/S60)?

I'm building a an application using Qt on the Symbian/S60 platform and I was wondering if there was a standard notification window that I could use to pass messages to users. Using other platforms as examples, I'm looking for something equivalent to Javascript's alert() method or Cocoa's NSRunAlert* methods. If there is not a native Sy...

Finding the end of a zlib compressed stream

I'm working on an NMDC client (p2p, DC++ and friends) with Qt. The protocol itself is pretty straightforward: $command parameters| Except for compression: "ZPipe works by sending a command $ZOn| to the client. After $ZOn a ZLib compressed stream containing commands will follow. This stream will end with an EOF that ZLib defines. ...

Missing QtCore...

I am trying to build a package from source and ./configure tells me I am missing package QtCore. Been googling & trying apt-get without success. Help please. ...

Cannot load SQL driver in Visual C++ (but loads in QtCreator)

I have a QT application that requires the MySql driver. I have both a .pro file to compile the app with QtCreator and a .vcproj for Visual C++ 2008 Express. The code is identical and it compiles without a hitch, but the executable created by Visual C++ Express gives me the following output and refuses to load any driver/plugin: QSqlData...

Cairo and Qt integration

Hi. I want to use Cairo graphics library whith Qt, but I can't find any documenattion. I just want to make the GUI whith Qt and use Cairo for drawing graphics in a Qt window. Thanks. ...

PyQt: Trouble with asterisk on modification in QPlainTextEdit

I'm having a problem with a QPlainTextEdit. I want the "contents have been modified" asterisk to appear in the title bar whenever the contents have been modified. In the example below, type a few letters. The asterisk appears as it should. Hit Ctrl+S, the asterisk disappears as it should. But then if you type a few more letters... w...

Using Qt with DirectX?

What exactly are my options? I have programs I need to write in OpenGL and DirectX, and I'd like to use Qt for OpenGL, and not have to re-implement half my program for the DirectX components of my task. I've looked on Google and I have found references to people complaining about Direct3D being a dependency of Qt, and people talking abo...

Qt - Find mouse screen x,y - even application closed.

Hello, I'm new to Qt. I'd like a window to follow the mouse around the screen. (It's a useful aid to reading) The best I can come up with is a timer that uses QPoint QCursor::pos() to move the window every .1 seconds. Rather than spinning this timer constantly, is there an event system I can tap into? This would look smoother, and u...

QDir and QDirIterator ignore files with non-ASCII filenames

The following code somehow fails to notice any files with non-ASCII characters in their names (Cyrillic characters, specifically): for (int path = 1; path < argc; path++) { QFileInfo fi(argv[path]); if (fi.isDir()) { QDir dir(argv[path], "", QDir::LocaleAware, QDir::AllEntries); qDebug() << dir.entryList(); QDirIterator ...

Localizing Application (main) Menu?

I'm porting a UNIX application which uses the Qt framework (Qt, not QuickTime) to Mac/Cocoa. Life is good, generally. Qt has a Cocoa implementation, so with some Objective-C++, I've gotten lots of Mac-specific bits working. I can't get the main menu (i.e., the Application menu) to translate. It's set using: [NSApp setMainMenu:menu]...

Qt painting without clearing the background

I'm using a QPainter to get some graphics on a window. Unfortunately every time the .paintEvent is run, the whole window is cleared. How can I draw without clearing? I.e. how do I leave the stuff from previous paint event untouched? I'm using Qt4 ...

Problem with resolving Qt headers in Eclipse [Linux]

My Eclipse CDT has some problems with either resolving Qt headers or code completion. The example will explain everything. Usually the include would look like this: #include <QPushButton> But when I use code completion in Eclipse it replaces the include with following: #include <qpushbutton.h> Technically everything works and the p...

QT: Using QPainter on child widgets

I'm having a QT/C++ problem with a simple QWidget program that draws an ellipse inside a child QWidget. The program is composed of: (1) A parent QWidget (2) A child QWidget (used as the drawing surface for an ellipse) (3) A draw QPushButton Here is part of the code (QPushButton Slot and Signal code omitted for simplicity) void Draw::...

QTimer vs individual threads

My program's really consuming CPU time far more than I'd like (2 displays shoots it up to 80-90%). I'm using Qtimers, and some of them are as short as 2ms. At any given time, I can have 12+ timers going per display -- 2ms, 2ms, 2ms, 250ms, the rest ranging between 200ms and 500ms. Would it be better if I used threads for some or all of t...