qt4

An "About" message box for a GUI with Qt

QMessageBox::about( this, "About Application", "<h4>Application is a one-paragraph blurb</h4>\n\n" "Copyright 1991-2003 Such-and-such. " "For technical support, call 1234-56789 or see\n" "<a href=\"http://www.such-and-such.com\"&gt;http://www.such-and-such.com&lt;/a&gt;" ); This code is creating the About message box which I wa...

Qt - a QWidget that has a clickable hyperlink

Please tell me how to create a QLabel on the QWidget that has a text that you can click and browser will open the mentioned link. Please bring here a code snippet. Thanks! ...

How to get the selectionchange event in Qt

Hi.. I have a class inherited from Qwidget, now in that class I will be creating "Qlistview" object and filling up the items to view.. When the selection of items in the listview gets changed I want to get the "selectionchange" event to come.. So how can I achieve this.. pls tell me in brief... thanks ...

Qt: force resource reloading on every compilation.

Is there a way to force QtCreator to recompile all the resources (images / qss files) i have specified in my qrc file every time i build the project? Currently if i change some styles in my qss file but dont remove the file and re-add it to the qrc file the old version of my qss file is used. Thanks. ...

building a static version of QT Library

I would like to build a static version of QT Library for X11 like shown in the doc Deploying an Application on X11 Platforms but I am stuck at the first step. where it says : cd /path/to/Qt ./configure -static -prefix /path/to/Qt make sub-src 1) Where is the path/to/Qt. Is this a path to libs or executables or what? In /usr/bin...

Is there a more expressive way of executing SQL query using Qt?

I currently have this code: // Construct query QString const statement = QString("drop database if exists %1") .arg(databaseName_); QSqlQuery query(db); query.exec(statement); Is there a better way to code than the above? Specifically, I dont like how I use QString for SQL statement. It'd ...

how to set the item selection forcefully in Qt

Hi.. Can any one tell me how to set the item to be selected forcefully.. I tried this after adding items to list row.. QModelIndex index = mylistview->currentIndex(); mylistview ->setCurrentIndex(index); its not working.. index I am getting index (-1,-1).. can any one help me on this Thanks ...

Using Qt CSS to set own Q_PROPERTY(QFont)

Hi there. I'm using Qt 4.6.2 and i have problem with QCSS. I have own Q_PROPERTY(QFont myFont READ myFont SET setMyFont). I want to change it with QCSS but it doesn't work. I've tried using normal font syntax but it doesn't work. I've also tried few other combinations like: qproperty-myFont: font(serif 20 1 0) font(serif 20 bold) QFont(...

Give labels in Qt Forms

How can I set a label in Qt Ui forms. ...

what is the mistake in my code

class myslot { public: Q_OBJECT myslot() { } ~myslot() { } typedef enum Emycars{volvo,benz,tata}cars; public slots: void hellowslot(myslot::cars); }; void myslot::hellowslot(myslot::cars cars1) { } class mysignal { public: Q_OBJECT public: mysigna...

How can I make calendar not select any date but focus should be on calendar?

How can I make calendar not select any date but focus should be on calendar? ...

Using QTDesigner with PyQT and Python 2.6

I'm new to Python and am starting to teach myself GUI programming (hopefully) using PyQT4.7 and Python 2.6 I just downloaded the whole PyQT/QT4 package (including QTDesigner) from the PyQT website, however it seems QTDesigner, which looks amazing to use as a newbie (since you can see all the attributes/properties/defaults etc) of each w...

How to change a QMenu text from english to russian by clicking a button

Please consider we have a menu which has text set "MyMenu" and I want to change the menu text by clicking a button in the same widget from "MyMenu" to "МойМеню". Could you bring a code snippet please for that operation? ...

Cannot connect QMainWindow and QDialog

Hi, I have a QMainWindow displaying a QDialog: CalibrationDialog d(this); d.exec(); My QMainWindow class has a signal: signals: void PenOn( QPoint p ); And QDialog has a slot: public slots: void on_PenON( QPoint p ); I tried connecting PenOn event to on_PenOn in two ways: After instantiating QDialog void MainWindow::on_a...

How to delete a widget from a stacked widget in Qt

Hi, I am using QStackedWidget to switch between the views, I will be able to traverse between the views, I am facing problem in some scenario, where I do not require the widgets, I want to remove them completely.. QStackedWidget provides the functionality to remove widgets, still the ownership of the widget will be there, I mean widget ...

Hiding an entry from a QMenuBar in Qt4?

I can find no non-deprecated way of hiding an item in a menu bar in Qt4. This post: http://qt.nokia.com/developer/faqs/585 gives a method that uses deprecated Qt3 compatibility functions. Is there a better way? ...

Latitude/Longitude Qt4 widget?

What is the best starting point for a Qt4 widget for entering Latitude/Longitude in DD:MM:SS format (degrees, minutes, seconds)? Customize a QLineEdit? A series of spin boxes? ...

Changing the color of a QTextBlock that is within a QTextDocument

Is there any other way to change the QTextLayout of a QTextBlock that is within a QTextDocument without having to subclass QAbstractTextDocumentLayout and call its documentChanged? I know that on a call to QTextBlock::layout() const ; "the returned QTextLayout object can only be modified from the documentChanged implementation of a QAb...

How to change the background of a text bloc in a text document in Qt

is there a way to change the background color of a QTextBlock in a QTextDocument without using a subclass of QAbstractTextDocumentLayout. I have tried many ways and the effects are null. I am trying from the textCursor() method of a QPlainTextEditor and it seems practically everything is const. ...

My listview is not gaining the keyboard focus in Qt

Hi, i am trying to operate the listview itesm through keyboard focus, its not moving.. can you folks suggest where i am wrong. if i click on the listview from mouse, listview is gaining the focus. i dont no what is wrong. class Newlist : public QWidget { public: Newlist(QWidget *parent = 0); ~Newlist(){}; public: QListVi...