qt

Qt context menu breaking selection in QTreeView

I have a QTreeView class with a context menu installed as follows: m_ui.tree->setContextMenuPolicy(Qt::CustomContextMenu); connect(m_ui.tree, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowTreeContextMenu(const QPoint&))); ... void ShowTreeContextMenu(const QPoint& point) { m_treeContextMenu->exec(m_ui.tree...

How to I get the function name while in a function for debug strings?

I want to output the function name each time it is called, I can easily copy and paste the function name, however I wondered if there was a shortcut that would do the job for me? At the moment I am doing: SlideInfoHeader* lynxThreeFile::readSlideInfoHeader(QDataStream & in) { qDebug("lynxThreeFile::readSlideInfoHeader"); } but wh...

Qt and no moc_*.cpp file

I'm developing a simple qt4 app and making my own dialog. I subclassed QDialog, inserted Q_OBJECT macro in class declaration block and.. I get [Linker error] undefined reference to `vtable for MyDialog' and there is no moc_MyDialog.cpp generated by moc compiler. I Use Qt 4.1.3 on windows XP and mingw - i do the build proces from QT su...

How to convert a number to a bytearray in bit endian order

I am trying to uncompress some data created in VB6 using the zlib API. I have read this is possible with the qUncompress function: http://doc.trolltech.com/4.4/qbytearray.html#qUncompress I have read the data in from QDataStream via readRawBytes into a char array, which I then converted to a QByteArray for decompression. I have the com...

In Qt, how do I set the background color of a widget like combobox or double spin box?

I am trying to set the background color for a double spin box, and I am not sure what function I should use. I saw some function called SetBackgroundRole which accepts a Qt::ColorRole, but I am not sure how to use this one as well. Kindly let me know, what's the simple way to change the background color of a combobox or doublespinbox? ...

Detailed information from QObject::connect

Is there a way to get a detailed failure information from QObjet::connect in case of its failure ? Returned boolean value doesn't give any information about reason of failure. I wish exception were so widely used in C++ as they are in Java. ...

What is the best HTML Rendering Engine to embed in an application?

At the moment, our application uses the Trident Win32 component, but we want to move away from that for a few reasons, chief among them being our desire to go cross-platform. We're looking at WebKit and Gecko, but I'd love to get some feedback before I make a decision. Here are some of the most important requirements: It should be rel...

QT: difference between moc output in debug and release?

Using the QT Visual studio integration, adding a new QT class adds two separate moc.exe generated files - one for debug and one for release (and one for any other configuration currently existing). Yet the two eventual generated files seem to be identical. On the other hand when adding a UI class, the uic.exe generated files don't have ...

On QT widgets like DoubleSpinBox or ComboBox, how do i have custom right click menu

I have a few combo-boxes and double spin boxes on my QT Dialog. Now I need a "ResetToDefault" item on a menu that comes up when you right click on the widget (spin box or combo box). How do i get it. Is there some way I can have a custom menu that comes up on right click or Is there a way i can add items to the menu that comes on right ...

QDockWidget initial width

How do I set the initial width of a QDockWidget? I have implemented the sizeHint function but what next? ...

Is it necessary for Qt::paintEvent to be reentrant?

Can I put the painter into the class variables? : protected: QPainter *myPainter; ... void MyWidget::paintEvent(QPaintEvent *event) { myPainter = new QPainter(this); ...

Compiling a QT program in Windows XP with MinGW's g++

I have a stub Qt application and I keep getting compiler errors #include <QApplication> int main(int argc, char *argv[]) { return 0; } I used qmake -project and qmake commands and as far as I can tell they did their job correctly. When I subsequently call make at the command line I get the following error: g++ -c -O2 -frtti ...

Qt Application fails spectacularly

I'm trying to link a Qt application with its libraries and the linker (MinGW) spews hundreds of lines like the following, and I am unsure how to proceed. cpp: undefined reference to `_Unwind_SjLj_Register' c:/qt/lib/libQtCore.a(qcoreapplication_win.o)(.text+0x29d):qcoreapplication_win. cpp: undefined reference to `_Unwind_SjLj_Unreg...

GTK+ or QT under Windows

Hello, I was wondering which one should I consider if I need the software to be used on both platforms, WIN and Linux and why? ...

Need to bring application to foreground on Windows

I've got two applications I'm developing using Qt on windows. I want the user to be able to press a button in one application which makes the other application come to the foreground. (The programs communicate using QLocalSocket / named pipes) Currently I'm using Qt's QWidget::activateWindow() which occasionally brings the application t...

Hide a tab previously added to QT TabWidget

I've a dialog which contains a QT TabWidget with a number of tabs added. I'd like to hide one of the tabs. _mytab->hide() doesn't work. I don't want to just delete the tab and all its widgets from the .ui file because other code relies on the widgets within the tab. However, it would be fine to generate the tab code but somehow ...

In QT, for a context menu item, how to hide the space of the icon

I am adding a context menu using QAction for a widget. Now, there is some white space beside the text of the action. I assume this is the space where the QIcon association with the QAction should have been there. Now how do i hide this space. I tried doing a action->setIcon(QIcon()); but still does not seem to work. Kindly let me know i...

CONFUSED -- c++ 3rd party library, new to c++

(mingw32, windows xp) Hello, I am attempting to migrate from Java to c++. I am confused and frustrated about finding, installing, and compiling non-standard c++ libraries. in Java it's so convenient they stuffed every functionality and documentation ever needed in java's standard api. Is there a list of essential c++ library such as Thre...

How do you debug Qt layout problems

I've got a complex dialog, and it is full of whitespace and I can't shrink it. In Designer, it has lots of components that then get dynamically hidden, and a few which are dynamically added. I've added dumping of size policies, size hints, and minimum sizes, but still can't figure out why Qt won't let me drag it smaller. There must be...

Good books on QT and Boost libraries

Hi everyone, I'd like you to recommend some fine books on Boost and QT libraries. I've been learning C++ for more than a year, I've learned the syntax and language basics, it's gotchas, a few development features and gotcha's. I don't have big experience in development. Read Eckel (Thinking in C++), Meyers. ...