qt

Grab mouse movement

I am writing a little utill for me on ruby using qt. How to access global mouse movement and keyboard input events? ...

How do I extract the angle of rotation from a QTransform?

I have a QTransform object and would like to know the angle in degrees that the object is rotated by, however there is no clear example of how to do this: http://doc.trolltech.com/4.4/qtransform.html#basic-matrix-operations Setting it is easy, getting it back out again is hard. ...

Qt & double buffering - are there any neat tricks to capture pixels or manipulate the back buffer?

I'm migrating an application to Qt from MFC. The MFC app would use GDI calls to construct the window (a graph plot, basically). It would draw to a memory bitmap back buffer, and then BitBlt that to the screen. Qt, however, already does double buffering. When the user clicks and drags in the graph, I'd like that section of the window ...

Decrease Qt GUI application size

Hi! I'm learning to develop apps using Qt Creator. I have built a simple app under Windows, depends on uses mingwm10.dll, QtCore4.dll, QtGui4.dll, QtNetwork4.dll. Out of QtQui4.dll I use only a a couple of widgets, and don't need all of the rest... Is it possible to either shrink the size of QtGui4.dll or do something else to decrease de...

Qt: QList of QButtonGroup

Hey! I try to do the following QList<QButtonGroup*> groups; for (int i=0; i<nGroup; i++) { QButtonGroup *objects = new QButtonGroup(this); objects->setExclusive(false); for (int j=0; j<nObject; j++) { Led *tempLed = new Led(); tempLed->setAutoExclusive(false); ...

QGraphicsItem : emulating an item origin which is not the top left corner

My application is using Qt. I have a class which is inheriting QGraphicsPixmapItem. When applying transformations on these items (for instance, rotations), the origin of the item (or the pivot point) is always the top left corner. I'd like to change this origin, so that, for instance, when setting the position of the item, this would ...

Qt: mouseMoveEvent and interfer with hoverEnterEvent of child object

Hi! I use QGraphicsView to create a sort of circut editor, which has elements in it, which have connectors. It should be possible to connect those connectors with wires. However I have a problem, while I drag from one connector to another, Qt grabs mouse, and other connectors stop receiving hoverEnterEvent. Btw, on hover connectors resiz...

Possible: Program executing Qt3 and Qt4 code?

Maybe its a very dumb question but I hope you can give me some answers. I have a commercial application which uses Qt3 for its GUI and an embedded Python interpreter (command line) for scripting. I want to write a custom plugin for this application which uses Qt4. The plugin is mainly a subclassed QMainWindow-class that is linked into a...

After setting a breakpoint in Qt, gdb says: "Error accessing memory address"

I wrote a very simple Qt program here: int main(int argc, char* argv[]) { QApplication app(argc, argv); QTableView table(&frame); table.resize(100, 100); table.show(); return app.exec(); } And when I try to set a breakpoint where the table gets clicked, I get this error from gdb: (gdb) symbol-file /usr/lib/libQt...

qmake and QT_INSTALL_PREFIX. How can I select a new location for Qt library?

I am new to qmake and I am trying to build an existing application. Qt was originally installed in /usr/local/lib/Qt-4.3.5 and 'qmake -query QT_INSTALL_PREFIX' returns that path. I have moved the Qt library to another location and the generated Makefiles are peppered with the /usr/local original path. How can I force qmake to use the n...

Unit testing in C++

I've been reading a lot about Unit tests and Test Driven developemnt. Recently, I also read java unit test code. I however, prefer to develop in Qt. So I googled up "unit testing in c++" and found a host of information about various unit testing frameworks available for C++. However, I could not find a reliable comparison of the the v...

Why does Qt add more than three columns when I use restoreState() on a QTableWidget?

My code looks somehow like the following: table = QTableWidget() table.horizontalHeader().restoreState(settings.value("savedState")) table.setColumnCount(3) settings.setValue("savedState", table.horizontalHeader().saveState()) If I run it the first time it there are only 3 column headers. The second time there are 6 and the third 9.....

Please point me to (good) documentation about QT layouts for plasma development

I am trying to develop a plasmoid in python. I got some good tutorials here (techbase.kde.org/Development/Tutorials/Plasma) and they are really helpful, but they don't have documentation or examples about QT layouts and their usage. I haven't programmed with QT, but I know C++ well. So, the resources shouldn't be necessarily python api...

Qt: Printing pageRect and paperRect issues

I have following printing code: void Print(QPrinter *printer) { QPainter q(printer); q.setRenderHint(QPainter::HighQualityAntialiasing, true); q.setPen(QPen(QColor("red"))); q.drawRect(printer->pageRect()); q.drawLine(printer->pageRect().topRight(), printer->pageRect().bottomLeft()); q.setPen(QPen(QColor("blue"...

lightweight C++ scripting library

I currently use QtScript for scripting functionality in my C++ application, but it's rather "heavy" on the cpu. When a thread evaluates all the scripts in a loop the cpu usage increases to 90%-100%. Even when i put it to sleep for 1 msec every 5 scripts it stays above 75% cpu usage. Are there any other, easy to implement, scripting fram...

Reducing WAV sound file size, without losing quality

My application needs to play sound files. The only cross-platform file format I can use is WAVE (I'm using QSound of the Qt framework). The file sizes of these sounds are quite large and I'd like to know if there is a way to reduce it, without losing (too much) quality. I need the file to be stereo. ...

QPainter colored text (syntax coloring)

I have a custom Qt widget which I used to display disassembly and I am looking to add syntax coloring to it. Currently, I simply set the QPen to a solid color, construct the text I want to display, and render it to the QPainter at the appropriate coordinates. The question is, what is the best approach to adding syntax coloring? I've th...

How to compile Qt 4.5.1 on Windows XP for WinCE?

I'm trying to compile Qt 4.5.1 on Windows XP targeting wince50. I have the prerequisites installed (VS2008, WinCE50SDK, ActivePerl 5.10) and have downloaded the qt-embedded-wince-opensource-src-4.5.1.zip which has been installed in c:\Qt\4.5.1 and c:\Qt\4.5.1\bin has been added to the path. From a VS command prompt, I navigate to c:\Qt...

QDBusAbstractAdaptor vs. QDBusAbstractInterface

When exposing some code to D-Bus using Qt D-Bus bindings, when should one use a Qt Adaptor over a Qt Interface? I'm having a difficult time understanding how exactly they differ since it seems like they provide the same functionality. ...

How can I redefine a built in keyboard shortcut's behavior?

I am attempting to re-implement the Copy behavior for a QTextEdit object. The custom context menu I create works as expected when the 'Copy' button is clicked, but Ctrl+C isn't being handled correctly. Since the context menu doesn't have any issues, I'll omit that portion of the code. // Create a text edit box for text editing QTextEdit...