Questions tagged [qtgui]

QtGui module extends QtCore with GUI functionality. It has collection of classes useful for creating Qt based GUI applications

Prior to , the Qt GUI module was the monolithic container for all things relating to graphical user interfaces in Qt, and included the Qt widget set, the item views, the graphics view framework and also printing. Starting Qt 5, these classes have been moved to the Qt Widgets module. Printing has been moved to the Qt Print Support module. Please note that these modules can be excluded from a Qt installation.

If you use qmake to build your projects, Qt Gui is included by default.

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

539 questions
4
votes
2 answers

delete all QSpacerItem from a layout

I've added a QSpacerItem to a layout using its addStretch() method. layout->addStretch(1); now i'd like to delete it but i didn't have any reference to it. how can I browse all QLayoutItem and only delete QSpacerItem ?
Ghilas BELHADJ
  • 13,412
  • 10
  • 59
  • 99
4
votes
1 answer

Memory-Management in Qt: AddressBook tutorial

So, I've learned so far, that Qt releases the memory of all child objects when a parent object gets deleted. Also, one generally doesn't have to care about memory management for objects created on the stack (i.e. NOT as pointers). Now, when I did…
Alex K
  • 90
  • 7
4
votes
3 answers

How to display superscript in QComboBox item?

I want to display 10-8 in QComboBox item. But it displays "sup" tags.
Alen
  • 53
  • 5
4
votes
1 answer

Child items not movable in QGraphicsView when ItemIsMovable flag is set

To resize items in a QGraphicsView, I'm putting child items representing vertices onto the item to be moved (using the parent-child relationship established in the constructor). Those are the four blue circles in the picture below: But the child…
folibis
  • 12,048
  • 6
  • 54
  • 97
4
votes
2 answers

Selecting a piece of text using QTextCursor

Having problems with selecting pieces of text using the Qt framework. For example if i have this document : "No time for rest". And i want to select "ime for r" and delete this piece of text from the document, how should i do it using QTextCursor?…
Zan
  • 290
  • 4
  • 17
4
votes
1 answer

How to open svg file in QT (QGraphicsView)

How to open svg file like png file. For example it works for png file: scene=new QGraphicsScene(QRect(10, 10, 680, 520)); view=new QGraphicsView(this); image=new QGraphicsPixmapItem(QPixmap("example.png")); scene ->addItem(image); view…
user3191398
4
votes
2 answers

Qt5: error: 'WA_LockPortraitOrientation' is not a member of 'Qt'

I'm trying to compile a Qt4/Symbian project to Qt5, while preserving support for Qt4/Symbian. Currently the MainWindow::setOrientation auto-generated boilerplate function is giving me trouble. It gives me these compiler errors: error:…
sashoalm
  • 75,001
  • 122
  • 434
  • 781
4
votes
1 answer

Why does QApplication give memory leaks?

I have a simple code: #include int main(int argc, char *argv[]) { QApplication a(argc, argv); return 0; } I compile it in Qt Creator using pro file: QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT +=…
user2717575
  • 369
  • 7
  • 16
4
votes
2 answers

Qt Splash Screen not showing

I have this code, I want it to show a splash screen since it will be bigger, having had made a kind of timer so it is possible to see the splash screen working. The problem is I don't see the splash screen, but the code will be running while the…
vitimiti
  • 77
  • 1
  • 8
4
votes
1 answer

Baffling behavior from QFontDatabase

I am trying to load a font into my application. Logically, I want to load more than one font weight, but that's where the problem arises. I have two font files, "PFD-Black.ttf" and "PFD-Regular.ttf". I want to use them both, so I load them both…
KFox
  • 1,166
  • 3
  • 10
  • 35
4
votes
1 answer

Memory management - Does addwidget assign a parent

Say I have something like this void someClass::start() { QLabel* sb = new QLabel(); sb->setText("Hello World"); ui.verticalLayout->addWidget(sb); } Does addWidget make sb a child of someClass so that when I delete someClass sb is also…
MistyD
  • 16,373
  • 40
  • 138
  • 240
4
votes
1 answer

How do I detect if a QImage is animated?

I'm using Qt 5.2 and I have a QImage. If it detects an image url (such as an imgur link) it downloads that image and displays it. I want to also animate it if the image is animated (such as a gif). I tried going by extension, but some links will end…
Ben
  • 764
  • 4
  • 19
4
votes
4 answers

Compile time error from a Qt file: expected unqualified-id before ')' token

Porting my project from Qt4 to Qt5.1, I get this error from a Qt file: C:\Qt\Qt5.1.1\5.1.1\mingw48_32\include\QtGui\qopenglversionfunctions.h:785: error: expected unqualified-id before ')' token void (QOPENGLF_APIENTRYP…
Pietro
  • 12,086
  • 26
  • 100
  • 193
4
votes
1 answer

Pass a QImage object between class methods

I have two functions. In one function, i have a QImage and then i want to pass that QImage to another function. Both the function have different Arguments. Please tell me how can i do it? CMakeLists.txt cmake_minimum_required(VERSION…
skm
  • 5,015
  • 8
  • 43
  • 104
4
votes
4 answers

How do I add a header with data to a QTableWidget in Qt?

I'm still learning Qt and I am indebted to the SO community for providing me with great, very timely answers to my Qt questions. Thank you. I'm quite confused on the idea of adding a header to a QTableWidget. What I'd like to do is have a table that…
San Jacinto
  • 8,774
  • 5
  • 43
  • 58