qt4

Qt QFileDialog - native dialogs only with static functions?

I'm trying to simply save a file. However, I need a filename entered without a suffix to automatically get a default suffix (which setDefaultSuffix() does). I'd rather not completely lose the native save dialog just for this. exec() is not overloaded from QDialog, so it totally bypasses the native hook (ignoring the DontUseNativeDialo...

Possible bug with tabified QDockWidget and setFloating()

I've run into some odd behavior with tabified QDockWidgets, below is an example program with comments that demonstrates the behavior. Is this a bug or is it expected behavior and I'm missing some nuance in QDockWidget that causes this? Directly, since this does not work, how would one properly "undock" a hidden QDockWidget then display...

Cross compiling from MinGW on Fedora 12 to Windows - console window?

After reading this article http://lukast.mediablog.sk/log/?p=155 I decided to use mingw on linux to compile windows applications. This means I can compile, test, debug and release directly from Linux. I hacked this build script which will cross compile the application and even package it in a ZIP file. Note that I am using out of sourc...

Launch a QWidget from a QMain window

I'm doing my first C++ - Qt4 application and I'm having some trouble "connecting" my different uis. I have a main window with several buttons and when I click on one, I want another window to open. The MyMainWindowClass inherits from QMainWindow and the other from QWidget. Here is the code I have written so far : #include <iostream>...

QString::number() - zero padding?

I want to "stringify" a number and keep leading zeros. Unlike this question: http://stackoverflow.com/questions/885401/print-trailing-zeros-in-a-qstring I also need this in hex. By code now uses this, which is not enough: QString::number(myNumber,16).toUpper() ...

Getting Arabic ligatures on Qt/Linux

Hi all. I've to port to Qt/Linux a Win32 code that relies on GetCharacterPlacement() call for properly handle Arabic ligatures in strings. While I've no problem at displaying these strings via QTextEdit or QLineEdit (Qt widgets correctly show ligatures), I can't "identify" and manage these ligatures. In other words, if I type 3 Arabic...

Implementing implicitly shared classes outside of Qt

I'm familiar with the way Qt uses D-pointers for managing data. How do I do this in my code? I tried this method: 1) move all data into a struct 2) add a QAtomicInt to the struct 3) implement a = operator and change my constructor/deconstructor to check-up on the reference count. The issue is, when I go to do a shallow copy of the obj...

Design question: Holding class metadata for dynamic lookup.

I have a couple of base/interface classes each of which has several derived classes. I have a need to store metadata on each derived class that has a lot of overlap, but different values. I also have a Factory class for creating instances of the derived classes that's implemented as a singleton and has a few macros. For example, you'd: ...

Qt/win: showMaximized() overlapping taskbar on a frameless window

I'm building an application that has its own custom chrome. I have turned the default window border off by setting the flag: this->setWindowFlags(Qt::FramelessWindowHint); After this flag is set and the default window border is turned off, any calls to: this->showMaximized(); result in a window that takes up the entire screen, over...

PyQt: How to keep QTreeView nodes correctly expanded after a sort

I'm writing a simple test program using QTreeModel and QTreeView for a more complex project later on. In this simple program, I have data in groups which may be contracted or expanded, as one would expect in a QTreeView. The data may also be sorted by the various data columns (QTreeView.setSortingEnabled is True). Each tree item is a lis...

Formatting Excel Document in Qt

Hi, I am using Qt 4.5 and Windows XP. I need to create an Microsoft Excel Document that has data (some labels and values) from the Qt application. I need to format those data with some fonts,bold,italics,color, background color etc., Besides ordinary data, there will be Picture files (JPG) also. I need to add those into the Excel. I know...

How to get selected listitem index in Qt

Hi all, I am having a QListView which having some items. Now i want to get the index of selected item. i.e. if i select 5th element i should get 5. How i can get this?.. waiting for reply. Thanks in advance -S ...

How to allow resizing of QMessageBox in PyQt4

I'm using the nice feature in QMessageBox to optionally show detailed text to the user. However, the window after expansion is still fairly small, and one immediately tries to resize the window so more of the details are visible. Even after setting what I think are the proper settings it won't allow resizing. Here's the relevant snippet...

Making File Dialog only accept directories

I want to have a file dialog only allow directories, here's what I've been trying: fileDialog = QtGui.QFileDialog() fileDialog.setFileMode(QtGui.QFileDialog.ShowDirsOnly) filename = fileDialog.getOpenFileName(self, 'Select USB Drive Location')) Thank You ...

AlignAbsolute on QGraphicsGridLayout

Hi I have four QGraphicsLinearLayout items all contaning bunch of QGraphicsWidgetItems. I have one QGraphicsGridLayout item. Is it possible to align linear layouts on grid to absolute positions. If possible how? ...

How to find item selected from customContextMenuRequested() on QTreeView item?

I have implemented contextual menus in QTreeView items with the following code MyDerivedQTreeView->setModel(MyDerivedQAbstractItemModel); MyDerivedQTreeView->setContextMenuPolicy(Qt::CustomContextMenu); connect(MyDerivedQTreeView, SIGNAL(customContextMenuRequested(const QPoint &)), MyDerivedQAbstractItemModel(), ...

How do I set the QT debugger to give more meaningful messages?

Hello all I'm currently learning the QT framework. I need to know if it's possible to set the debugger to give meaningful messages as opposed to what it gives me right now, which is the failed step in the build process (usually the '.o' file) I need to know if it's possible to set it to giving meaningful message like Visual studio ...

How do I change properties of buttons within button boxes in Qt4 designer?

I have been searching online now to no avail, but does anyone know how to access a button in a button box ?(created using the "Dialog with Buttons right" template) ...

Setting background image for QPushButton

Hi Geeks, I am struggling to set an background image for an QPushButton. No Success till now. Following is my code. appsWidget::appsWidget(QWidget *parent) :QWidget(parent) { QPushButton *button1 = new QPushButton("SETTINGS",this); QPushButton *button2 = new QPushButton("TEST",this); QPushButton *button3 = new QPushButt...

How to overload operator<< for qDebug

Hi, I'm trying to create more useful debug messages for my class where store data. My code is looking something like this #include <QAbstractTableModel> #include <QDebug> /** * Model for storing data. */ class DataModel : public QAbstractTableModel { // for debugging purposes friend QDebug operator<< (QDebug d, const Data...