qt

How to delete a QProcess instance correctly?

Hi everyone! I have a class looking like this: class FakeRunner : public QObject { Q_OBJECT private: QProcess* proc; public: FakeRunner(); int run() { if (proc) return -1; proc = new QProcess(); QStringList args; QString programName = "fake.exe"; connect(comp, SIG...

More compact layout

In the following code, I'd like to get rid of the margin around the buttons. I'd like to have the buttons stretch all the way to the edge of the frame. How can I do that? import sys from PyQt4.QtGui import * from PyQt4.QtCore import * app = QApplication(sys.argv) window = QWidget() layout = QVBoxLayout() layout.setSpacing(0) window....

Resize shared memory

Hi, I'd like to know if there is any way to resize a variable of QSharedMemory (in Qt) once it has been allocated. Thanks ...

HowTo stick QDialog to Screen Borders like Skype do?

Hello. A long time ago I tried to find method how to stick QDialog window to screen borders for my small projects like Skype windows do it, but I failed. May be I was looking this code not in the right place, so now I'm looking the solution here, on stack! :) So, does any one have a deal with some kind of such code, links, samples? In...

Expose C++ object to Javascript in Qt

Is there any way I can expose a C++ object/function to JavaScript running inside the QtWebKit browser in Qt? It's possible to expose ActionScript objects to JS code running inside the WebKit browser in Adobe AIR - I'm looking for similar functionality in Qt. ...

Speed of QHash lookups using QStrings as keys.

I need to draw a dynamic overlay on a QImage. The component parts of the overlay are defined in XML and parsed out to a QHash<QString, QPicture> where the QString is the name (such as "crosshairs") and the QPicture is the resolution independent drawing. I then draw components of the overlay as they are needed at a position determined dur...

Start and run a class member function in background, in QT/C++

Once a minute I want to run a task, not blocking other GUI functions. I heared somthing about QConcurent::run ... Or should I use signals and slots? ...

How can I set the line style of a specific cell in a QTableView?

I am working with a QT GUI. I am implementing a simple hex edit control using a QTableView. My initial idea is to use a table with seventeen columns. Each row of the table will have 16 hex bytes and then an ASCII representation of that data in the seventeenth column. Ideally, I would like to edit/set the style of the seventeenth column t...

Reserve space for initially hidden widget in QVBoxLayout within QScrollArea

I am using a QVBoxLayout to arrange a vertical stack of widgets. The QVBoxLayout is contained within a QScrollArea. I want some of the widgets to be initially hidden and only show up when a check box is checked. Here is an example of the code I'm using. MyWidget::MyWidget(QWidget *parent) : QWidget(parent) { QVBoxLayout *layout =...

Get http status in Qt WebKit

Hello all: What I would like to implement is 1 Using Qt's WebView(part of QtWebKit) to access some page. 2 Show specified html page if got HTTP 4xx, 5xx status (Ex> HTTP 404, 500). 3 Also shows specified page when network connection is unavailable. For now, I had only done job 1... In job 2, how did I get http status from WebView ?...

How to use QCOMPARE Macro to compare events

Hi, I have MyWindow class which popus a blank window, which accepts a mouse click, I need to unit test the mouse click event Code snippet: void TestGui::testGUI_data() { QTest::addColumn<QTestEventList>("events"); QTest::addColumn<QTestEventList>("expected"); Mywindow mywindow; QSize editWidgetSize = mywindow.size(); QPoint clickPoin...

Using Qt's XML library for simple operation

I basically want to use the XML parser from Qt in my existing project. I have only used Qt once before, and that was with Qt Designer, and I am not having much luck finding anything on Google about how to just use the XML library. I have downloaded a web page that has one large list, and I want to parse it and add each list item to a c+...

How does large text file viewer work? How to build a large text reader

how does large text file viewer work? I'm assuming that: Threading is used to handle the file The TextBox is updated line by line Effective memory handling is used Are these assumptions correct? if someone were to develop their own, what are the mustsand don'ts? I'm looking to implement one using a DataGrid instead of a TextBox I...

how to implement OOP using QT

hi, this is a simple OOP QT question. my app consists of main window (QMainWindow) and a table (QTableWidget). in the main window i have arguments and variables which i would like to pass to the table class, and to access methods in main widnow class from the table class, how should i do it ? mainwindow.h class MainWindow : public QMai...

C++ resize a docked Qt QDockWidget programmatically?

I've just started working on a new C++/Qt project. It's going to be an MDI-based IDE with docked widgets for things like the file tree, object browser, compiler output, etc. One thing is bugging me so far though: I can't figure out how to programmatically make a QDockWidget smaller. For example, this snippet creates my bottom dock window...

QPainter declared inside a run function creates artifact.

I am rendering a QPixmap inside of a QThread. the code to paint is inside a function. If I declare the painter inside the drawChart function everything seems ok but if I declare the painter inside the run function the image is wrong in the sense that at the edge of a black and white area, the pixels at the interface are overlapped to g...

Qt 4.x: how to implement drag-and-drop onto the desktop or into a folder?

Hi all, I've written a little file-transfer application written in C++ using Qt 4.x ... it logs into a server, shows the user a list of files available on the server, and lets the user upload or download files. This all works fine; you can even drag a file in from the desktop (or from an open folder), and when you drop the file icon in...

How to choose which Network interface to use?

I use Qt for my TCP communication. If my PC has 2 network interfaces (say eth0, eth1), and say I want to explicitly use eth1, how do I do that in Qt? ...

How to connect menu click with action in Qt Creator?

I am completely new to Qt. I started with a new Qt4 GUI Application. Using the designer, I have created a menu like so: File - Exit How do I get an action associated with the menu item? I found something called the 'Signals and slots editor' but have no idea how to use it. ...

How to add a slot to my main window in Qt builder?

I am using Qt Builder to create a simple window. I used the menu editor to add a menu. Now, I figured out how to connect one of the menu items to the close() method of the main window. My problem is how to add a slot to the main window. Here is what I have: private slots: void OnAbout(); However, I can't get this method to show ...