qt4

What exactly are signals and slots in Qt?

I know how they work conceptually, but how are signals and slots implemented in the Qt framework? Qt Creator treats them as keywords, but are they simply a set of macros, or is a special pre-processor required before these source files can be compiled? In other words, if I use Qt's signal/slot features in my code, can I easily compile ...

Porting QT application from Linux to Windows?

Greetings all, We are developing a QT application (QT 4.6 LGPL version) in Linux platform.All the libraries we use are cross-platform. Now we want to port it into Windows and continue develop in Windows. My questions are: Which compiler should we use ,Can we use MinGW or Visual C++ compiler? 2.If its Visual C++ compiler, which Visua...

Qt - change QWidget layout

Let's consider we have a QWidget and a layout named general_layout that contains other widgets and layouts. general_layout is set as the QWidget layout (setLayout(general_layout)). Now I should to change the content of QWidget. How should I do? I have tried to delete and create a new layout for QWidget and that new layout set as a layou...

HowTo Crypt/Encrypt some string (e.g. Password) on Qt simple

Hi. Here what I have got: Qt SDK version 4.6.2 Windows XP Question: how can I simply crypt and encrypt simple QString value? I need this to be able to save some crypted string into the INI file, and after reopening application encrypt string to normal password string value. PS: I'm looking simple and nice solution. Thanks for help...

Newbie: Minimal program to display a PNG in a window

All, I must have a fundamental neuron missing, but I cannot get a simple program to load a PNG file and display it in a window. I'm not sure if it is a QPixmap, a QPicture, or what. All of the samples in the QTCreator are a bit more than I need right now. Baby steps... I can get the window to display, and the program doesn't barf whe...

How to use the `itemDoubleClicked(QTreeWidgetItem*,int)` signal in qtHaskell

I want to use the itemDoubleClicked(QTreeWidgetItem*,int) signal in a Haskell program I'm writing where I am using qtHaskell for the GUI. To connect a function I have at other places done the following: dummyWidget <- myQWidget connectSlot object signal dummyWidget "customSlot()" $ f Where object is some QWidget and signal is a string...

Can't get custom slot working in PyQT4 with QT4 designer

Hey, I am new to PyQT4. After some tuts I decided to make a simple GUI in which I will enter text in first line and on clicking of Reverse button ,it will show reversed string on second line. I made a custom slot for this,by defining the function in my class.But when I click reverse nothing happens. I have used in-bilt slots for Clear...

QTextDocument eats multiple whitespaces

There is a Qt/C++ code: #include <QtCore/QCoreApplication> #include <QtGui/QTextDocument> #include <QByteArray> #include <QDebug> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QTextDocument *doc = new QTextDocument(); qDebug() << " === Document was: === "; qDebug() << doc->toHtml(QByteArray()); ...

how to create a theme with QT

hello im looking for a way to make my pyqt interface look nicer by adding a theme to it. im new to Qt and i still have no idea how to add a custom theme for widgets.. so how is that possible ? and is it possible through qt designer ? sorry for my bad english , its my third language. i hope the idea is clear enough . please let me kn...

how to set a pop up menu on a particular table view item

hello i have a QTableView , and i need to show a popup menu that shows the item properties . i need to set the context menu to apear only when you right click over a particular items in that tableview. but coudln't find a way to do it . i can set the context menu to appear when your over the table . i cant have it for each item . so ho...

How to generate a window (widget) on button press in qt

I had designed some gui through Qt cretor on linux,these design consists of some fields, text edit , & some push buttons . Now my doubt is when i press on push button i want display aanother window . Is there any GUI option for this or any hard code.please let me know if any hard code............. waiting for answer Tanks in advance. ...

QT: How can I create a QPIcture from a resource?

Lets say I have a resource at ':images/pic.gif' Can i make a QPIcture from this resource or does it have to be loaded from file? ...

PyQt4: My database displays empty cells

Hello everyone. I am using the pyqt4 framework to do some displays for database forms. Unfortunately, I hit a snag while trying to filter and display my database by last name. Assume that the database connection works. Also assume that I have the correct amount of items in my tupleHeader since I use the same initializeModel method fo...

what property should i set to Fit the text in label

Hi, i want to display a big string in Qlablel for this simply i have created a label in Qt GUI editor, then i put the string, with the Wordwrap property ON. here text is not coming to the next line itself, instead its crossing the view region. but if i give "\n" it works well. how to put up big string in label, to display in visible r...

QT Question (general math really): How can I tell if an Ellipse and a Line have an intersection?

The ellipse is actually a circle. I know all the coordinates of both things, I just need to know whether or not a line goes through an ellipse. Is this built in anywhere? SPecifically I am using QGraphicsEllipseIem and QLine but i can convert them to any other type thanks ...

A few questions about foreach loop and performance

Hi! I have a few foreach related questions below I hope that somebody could answer. I know that most people do not care about the possibly insignificant differences, but I want to understand them for completeness. 1) Could somebody explain how the foreach keyword in Qt actually works behind the scenes. I would like to know if foreach cr...

ld returned 1 exit status

This is the code that i'm trying to run: #include <QApplication> #include <QPushButton> int main(int argc,char *argv[]) { QApplication app(argc,argv); return app.exec(); } And this is the error that i'm getting: :-1: error: collect2: ld returned 1 exit status ...

QT intellisense question

in this code: #include <QApplication> #include <QPushButton> int main(int argc,char *argv[]) { QApplication app(argc,argv); QPushButton *button = new QPushButton("Button Text"); QObject::connect(button,SIGNAL(clicked()),&app,SLOT(quit())); button->show(); return app.exec(); } intellisense is appearing when the cur...

Lots of pointer casts in QGraphicsView framework and performance

Since most of the convenience functions of QGraphicsScene and QGraphicsItem (such as items(), collidingItems(), childItems() etc.) return a QList you're forced to do lots of qgraphicsitem_cast or static_cast and QGraphicsItem::Type() checks to get hold of the actual items when you have lots of different type of items in the scene. I thou...

Context Menu event with QGraphicsWidget

In my application I subclass QGraphicsWidget In paint I am drawing a line with pen width 4. I reimplemented boundingRect() and shape(). But I can't catch context menu event every time I click right mouse button. What is the problem.(Pen Width ? ) //Sample code for boundingRect() and shape() QRectF boundingRect() const { qreal r...