qt

focusNextChild problems in PyQt

I'm trying to set the focus from one widget to the next one using the focusNextChild() method. It works, but I there seems to be a slight difference between using the tab-key or doing things in code. If the next control is a button, using the tab-key results in a focused button with its caption surrounded with little dots, so you see imm...

What are the major issues to look for when moving an application built in Qt for a Symbian platform to a Windows Mobile platform?

I have an existing application created using Qt for the Symbian operating system and I want to port it to Windows Mobile devices. I'm expecting some presentation differences. What additional things should I look out for? ...

How do I auto-adjust the size of a QDialog depending on the text length of one of its children?

I have a QDialog I am working with. It is made somewhat like a QMessageBox. I noticed that the size of the QMessageBox (and the size of its label) depends of the size of the message displayed. How would I make the size of my QDialog adjust automatically like a QMessageBox. Presently my QDialog contains a button box, a label and the Q...

How do I set a background color for the whole window of a Qt application?

Does anyone know if/how one would be able to set a background color for the whole window of a Qt application? So far I am using stylesheets but can only figure out how to assign a background color to a widget such as QGroupBox or QPushButton. Basically, if I want a black background how would I make it seamless without any borders of the ...

How to remove spacebar action from QToolButton

I have a QToolBar on which there is a QToolButton. When QToolButton is pressed by mouse click then it perform some action. The same action is performed when space bar is pressed. I dont want the action to be fired on space bar press, but I want it on mouse click. How I can do this? ...

How can I autoexpand an item in a QTreeView when it is filtered by QSortFilterProxyModel?

I have a normal QTreeView, a custom QAbstractItemModel and a custom QSortFilterProxyModel. I've reimplemented QSortFilterProxyModel::filterAcceptsRow to filter items from my model in the way I want, however now I want those filtered items to be expanded in the treeview. The obvious solution was to emit a signal from QSortFilterProxyMo...

DllMain and Qt Mfc Migration

Hello I am using the Mfc to Qt migration solution, to migrate my Mfc plugin to Qt. My Mfc plugin is loaded in third party Mfc app. Basically I am using the following example Qt based Application Extension : BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID ) { static bool ownApplication = FALSE; if ( dwReason == DLL_P...

How insecure is / replacement for tmpnam?

I considered using tmpnam to set the output file name of a QPrinter. But the Python documentation recommends against using it. os.tmpnam() Return a unique path name that is reasonable for creating a temporary file. ... Applications are responsible for properly creating and managing files created using paths returned by t...

Qt Custom Window

Hi, Pardon me, I am a newbie :) Is it possible in Qt to create a custom window without borders but still draggable without holding down the Alt Key? I created a borderless window but in order to be able to drag it (on Linux) you have to hold down the alt key. I was planning to create a window with rounded corners. Any one have any ide...

Qt Icon embedded in Executeable

I have some buttons on a tabwidget. These buttons need to have some icon on top of them. I am aware of QPixmap that will allow me to put an image on top of a button, but I see that these constructors take a filepath as a parameter. I want to avoid dragging icons around in a file after I build. I would like to embed these icons in the ex...

How to stop a running thread safely on user request?

I'm in a scenario when I have to terminate a thread while the thread is running according to user action on GUI. I'm using Qt 4.5.2 on Windows. One way to do that is the following: class MyThread : public QThread { QMutex mutex; bool stop; public: MyThread() : stop(false) {} void requestStop() { ...

Which windowing system for embedded Linux supports Hardware Overlay?

Which windowing system for embedded linux supports hardware overlay? Is it possible to add hardware overlay support in Qt for embedded Linux? ...

Submitting QSqlRecord to MySQL database in Qt

I want to access a MySQL database and I want to read+write data from+to the database within my Qt/C++ program. For the read write process, I try to use QSqlTableModel, QSqlTableRcord and QSqlDatabase as this is a very pleasant approach without too much of SQL commands which I dislike for the one or other reason (to handle myself). I got ...

QT: table widget, numbers only

Dear All, first I apologize for the probably silly question. I am having trouble with QT. I have a table widget with four columns; I want the user to be able to insert only integers in the first three and a double in the fourth. I believe that this can be done with delegate, but I have not found relevant examples (only some with QDateT...

Need a little help with the Qt painting classes

I'm trying to write a paint program (paint where ever a mouse press/hold is detected), but I'm having trouble using the Qt QPainter. I have read the documentation on their web site and I'm still kind of lost. A link to a tutorial that isn't on their web site would be nice or maybe explain to me how I can accomplish this in Qt. The only t...

Qt: How to get the file/resource path for a QIcon

So let's say I do something like this: QIcon myIcon(":/resources/icon.ico"); How can I later determine the path for that icon, e.g. QString path = myIcon.getPath(); The problem is, there is no getPath() member. And I can't find anything similar, but surely there must be a way! :( I guess I could inherit the QIcon class and add thi...

Styling a QScrollBar by QStyle

I try to style a QScrollBar via a custom QStyle but if i draw nothing in drawComplexControl for the QScrollBar, the required space for the scrollbar on the parent widget is painted black. If i do the same with, eg a QToolButton simply the toolbutton is not painted but there is no black rect on the widget. That is what i would expect. But...

Is there a way to package a dynamic library in the application binary?

Hi I am developing a Qt application that uses a plugin (dynamic library) and I was wondering if there was a way I could build the application and library in one file (maybe using the QResource feature?) ...

Qt QHboxLayout cell size ssues

For those of you who haven't been reading my Qt questoins, I am learning Qt for a project. I have only limited experience with GUI design at all, and not in Qt. I've got a horizontal layout that I want to populate with some buttons. I can feed these buttons in just fine, but my formerly-square buttons are stretched horizontally to take ...

Qt Dialog Window Opens in Same Window

I managed to get a QPushButton to open a new window when pressed by using the following code (just snippets of code): AppDialog::AppDialog(QWidget *parent) : QDialog(parent) { QPushButton *button3 = new QPushButton(tr("Apps")); QHBoxLayout *hLayout = new QHBoxLayout; hLayout->addWidget(button3); setLayout(hLayout...