qt

mouse over transparency in Qt

I am trying to create an app in Qt/C++ with Qt4.5 and want the any active windows to change opacity on a mouseover event... As i understand it, there is no explicit mouseover event in Qt. However, I got rudimentary functioning by reimplementing QWidget's mousemoveevent() in the class that declares my mainwindow. But the mainwindow's mo...

c++ for loop vs foreach

Which is better( or faster) c++ for loop or the foreach operator provided by Qt? For example,the following condition QList listofstrings; Which is better? foreach(QString str, listofstrings) { //code } or int count = listofstrings.count(); QString str = QString(); for(int i=0;i<count;i++) { str = listofstrings.at(i); //code } ...

pyqt4 and pyserial

I want to do an app constantly watching the serial port and changing the user interface according to the input received from the port. I've managed to read lines from the port with pyserial under Linux, but I'm not sure how to do this in a regular fashion: create a separate thread and check for input on a timer event? How do i make sure ...

One executable that starts as gui application or console application based on command line in VS2005

I have a qt application in VS2005 which is linked using \subsystem:windows such that when I run the compiled executable it does not create a command line terminal, as well. I would like to create a command line mode: when I start it with --nogui command line argument, then the gui is not presented but a simple command line program is ru...

Qt best choice for animation on embedded?

I'm looking into technologies for a new embedded product that has a 1 ghz via processor, and a via s3 graphics chip. So far the target platform is Linux, but would like the option to move it over to a windows based platform. The application would consist of widgets like buttons, graphs, and numeric/text displays. More importantly, the ...

QSocketNotifier problem

I get the following message on the konsole,while running the application "QSocketNotifier: Invalid socket 12 and type 'Read', disabling" I get this message and then the application get crashes. I am running Qt 4.3.3 on Linux machine. I am using TCP-Ip communication in my application. No core-dump occurs,when i get the above error. The a...

How can I make days wrap around in a QDateEdit?

The standard behaviour is, that as soon as the day reaches 31 the step-up button stops working. I'd like it to reset to 1 and jump to the next month. ...

How do a specify a library file dependency for qmake in Qt?

Have a SomeLib.pro file that contains: CONFIG += debug TEMPLATE = lib TARGET = SomeLib .. Then in a dependent SomeApp.pro: .. debug:LIBS += -lSomeLib_debug .. How can I force SomeApp to build if I touched SomeLib in qmake? ...

Qt and context menu

Hello, i need to create a context menu on right clicking at my window. But i really don't know what should i do. Are there any widgets or i must make it by my hands? Programming language: Python Graphical lib: Qt (PyQt). ...

Find QWidget of single instance Qt application

I'm trying to create a single instance Qt application and I'm at the point this works, but now I want to focus the already started instance when a second is started. QWidget::find(g_hWnd) should return the widget but it fails and crashes on w->show(); Any thoughts? #pragma data_seg("Shared") HWND g_hWnd = NULL; #pragma data_seg() #prag...

Boost serialization in Qt: is it a proper way?

I'm thinking about serializing data in an application which is Qt-based. Essentially what I'm going to serialize is my hierarchical model, which is composed of different classes that derive from, say, TreeModelItem: class TreeModelItem { protected: QList<TreeModelItem *> m_children; //... }; Should I study boost::serialization an...

How should I link a data Class to my GUI code (to display attributes of object, in C++)?

I have a class (in C++), call it Data, that has thousands of instances (objects) when the code is run. I have a widget (in Qt), call it DataWidget that displays attributes of the objects. To rapidly build the widget I simply wrote the object attributes to a file and had the widget parse the file for the attributes - this approach works, ...

How to clean up a complex QList?

I'm using a rather complex QList in a derivation of QAbstractTableModel to store data: class MyTableModel : public QAbstractTableModel { Q_OBJECT QList<QHash<int, QHash<int, QVariant> *> *> m_data; /*...*/ }; MyTableModel::~TMusicTableModel() { /* Should I deallocate QList items? */ } MyTableModel::setData(int r...

Automatically sorting on insert in QTreeWidget

I have a QTreeWidget that I insert items in, and the user can select a column to sort it. As the items are being inserted, they just get appended to the end instead of having the sort being done automatically. If I click the header to switch between ascending/descending it will sort the current items. I figured I could call sortItems() ...

How do I watch a serial port with QSocketNotifier (linux)?

Could someone give me an example on how to setup QSocketNotifier to fire an event if something comes on /dev/ttyS0 ? (preferably in python/pyqt4) ...

QList and shared_ptr

What do you think? Is this correct or are there memory leaks? Source: #include <QList.h> #include <boost/shared_ptr.hpp> #include <iostream> class A { private: int m_data; public: A(int value=0) { m_data = value; } ~A() { std::cout << "destroying A(" << m_data << ")" << std::endl; } operator int() const { return m_data...

Custom widget plugin for qt designer is invisible

I've tried to create a custom widget plugin for QT Designer following this (http://doc.trolltech.com/4.3/designer-creating-custom-widgets.html) tutorial and was somewhat successful. Basically, I can place my new widget in Designer, but it doesn't draw (I get an empty square instead of whatever I try to draw in my paintEvent method, I sta...

Is there a way to make drawText() update a QPicture's bounding rect?

Drawing on a QPicture should update its bounding rect. Like this: >>> picture = QPicture() >>> painter = QPainter(picture) >>> picture.boundingRect() QRect(0,0,0,0) >>> painter.drawRect(20,20,50,50) >>> picture.boundingRect() QRect(20,20,50,50) But if I draw text on it, the bounding rect isn't updated: >>> picture = QPicture() >>> pa...

PyQT combobox only react on user interaction

I have a listbox that you can select users in. To the left of that is a combobox listing the available groups the user can be put it. If the user is in a group, the combobox will automatically be set to that group. I want to make it so when you change the group selection, it will move the user to that group. I added this connection: QtC...

Simple inter-proccess communication in Qt4

I need to make so that my application can have only one instance running at a time. Also when it's launched with a command line parameter ( like when registered to open certain file types ) it should pass the parameter to an existing instance and quit immediately without displaying graphical interface. You all probably know what I mean. ...