qt

PyQt: how to handle auto-resize of widgets when their content changes

I am having some issues with the size of qt4 widgets when their content changes. I will illustrate my problems with two simple scenarios: Scenario 1: I have a QLineEdit widget. Sometimes, when I'm changing its content using QLineEdit.setText(), the one-line string doesn't fit into the widget at its current size anymore. I must select ...

QT Signal to specific object's slot

Hello, I would like to know which of the following is the proper way of doing thing with signal/slot in QT. I need a way to have multiple instance of a Dialog, i.e: A and B. And I need to tell A to print "A" and B to print "B" from a different thread. So I believe I need something like either: OPTION 1) A->print("A"); and B->print("B"...

Qt: Add UI Elements using Qt Script

Is it possible to add new GUI elements into a Qt program using QtScript? For instance assuming the variable "layout" is a vertical layout would this be acceptable? var label = new QLabel("Text"); layout.addWidget(label); ...

Qt GraphicsScene constantly redrawing

I've written my own implementation of QGraphicsView.drawItems(), to fit the needs of my application. The method as such works fine, however, it is called repeatedly, even if it does not need to be redrawn. This causes the application to max out processor utilization. Do I need to somehow signal that the drawing is finished? I read the so...

Qt: Square constraint on window resize

I have a QDockWidget with a single square widget inside. I would like the ``QDockWidget to be resizable, but to always maintain a square shape, whereas by default it can be stretched disproportionately. What combination of size policies, size hints, etc. do I need to set to do this? ...

Qt programming tutorials (C++)?

I want to learn Qt programming, where do I get the good stuff? I want to develop in Windows and Linux. Which are the main IDEs? What are the main things I want to take care of or understand before starting to learn? ...

Qt QTableView and horizontalHeader()->restoreState()

I can't narrow down this bug, however I seem to have the following problem: - saveState() of a horizontalHeader() - restart app - Modify model so that it has one less column - restoreState() - Now, for some reason, the state of the headerview is totally messed up. I cannot show or hide any new columns, nor can I ever get a reasonabl...

Signal/Slot vs. direct function calls

So I have starting to learn Qt 4.5 and found the Signal/Slot mechanism to be of help. However, now I find myself to be considering two types of architecture. This is the one I would use class IDataBlock { public: virtual void updateBlock(std::string& someData) = 0; } class Updater { private: void updateData(IDataBlock &...

Qt: transparent QRubberBand?

I'm trying to draw a QRubberBand on a QGLWidget. For some reason the area of the rubber band is drawn as opaque and I don't see what's behind it. This kinda beats the purpose of the rubber band as a way to select stuff inside it. I've seen in docs for QStyleOptionRubberBand that there's an 'opaque' member but I have no idea how to access...

OpenGL Alpha blending with wrong color

I am trying to create a simple ray tracer. I have a perspective view which shows the rays visibly for debugging purposes. In my example screenshot below I have a single white sphere to be raytraced and a green sphere representing the eye. Rays are drawn as lines with glLineWidth(10.0f) If a ray misses the sphere it is given color glC...

QMake 'subdirs' template - executing a target?

I am putting together a build system for my Qt app using a qmake .pro file that uses the 'subdirs' template. This works fine, and allows me to specify the order that each target is built, so dependencies work nicely. However, I have now added a tool to the project that generates a version number (containing the build date, SVN revision...

Is there any special category for external files in project file of Qt Creator?

I'd like to keep in my project some external files, let's say .txt ones. Is there any special category for external files in project file (.pro) of Qt Creator? ...

QWidget::find(hwnd) always returning 0

Hey, I'm grabbing a window handle with the following code: HWND hwnd = FindWindow(L"QWidget", NULL); and it returns a HWND to a QWidget (I checked with Spy++, the handles match). But after this, if I try the following: QWidget* widget = QWidget::find(hwnd); or QWidget* widget = QWidget::find((WId)hwnd); widget is always 0. Does ...

How to access DOM of a web page in QtWebKit?

How to access DOM of a web page in QtWebKit? I don't see any methods exposing DOM in QtWebKit... ...

C++ and Qt - Problem with 2D graphics

Mission: Draw two lines with different color on one graph with automatic cliping, by adding points bit by bit. So, what am I doing. Create class GraphWidget, inherited from QGraphicsView. Create member of QGraphicsScene. Create 2 QPainterPath instances, and add them to graphicsScene. Then, I eventually call graphWidget.Redraw(), where ...

Finding a 3rd party QWidget with injected code & QWidget::find(hwnd)

Hey, I have a Qt Dll wich I inject into a third-party Application using windows detours library: if(!DetourCreateProcessWithDll( Path, NULL, NULL, NULL, TRUE, CREATE_DEFAULT_ERROR_MODE | CREATE_SUSPENDED, NULL, NULL, &si, &pi, "C:\\Program Files\\Microsoft Research\\Detour...

How to create a subdirectory for a project in qt-creator?

I would like to divide my qt project into several directories, because it is growing pretty large. However, when I click in browser in qt-creator, there is no 'Add directory' and no such thing in 'Add new'. Can this be done somehow? ...

QT & UDP-Socket

Hi, I have a question about QT & network sockets. If I have a computer with multiple IP-Adresses in different networks, how do I open an udp socket for a multicastgroup on a specific network-adapter/ip adress. eg: ip: 192.168.2.1 and 172.20.0.1 and I want to create a socket that receives packets from the multicast group 228.5.6.7 on th...

Dynamically manipulate Qt GUI

Is there any way to open a Qt process and then programatically add widgets? For example, start a process that opens a frame and then, with another call from, say, another program (that is mine; actually another scripting language), add a button to that frame? So, in another program, I say "open frame" at the prompt and the frame opens....

rtf / doc / docx text extraction in program written in c++/qt

I am writing some program in qt/c++, and i need to read text from ms word/rtf/docx files . And i am looking for some cmd program that can make that extraction . It may be several progs. the closest thing i found is http://silvercoders.com/index.php?page=DocToText but it has several bugs so i cant use it . I have also ms word installed on...