qt

Reading the final name of a file downloaded using QNetworkAccessManager

When downloading a file using QNetworkAccessManager (Qt 4.5.2) is possible that the original URL redirects to a new one containing the real name of the file downloaded. How this file name can be read? The answer should be QUrl QNetworkReply::url () const as the documentation says that: Note that the URL may be different from that of t...

QWebElement information where on page it is rendered ?

Looks like access to DOM and rendering details of HTML tags are not availabel in qt 4.5.x . Current snapshot QWebElement looks like proper class to be used there Anybody can give me info if is it possible to get from QWebElement information where on page it was rendered ? Or there are other ways to get that information ? TIA, regards ...

Microsoft Visual Studio: Loading resources in Qt application (without plug-in)

We don't have a Qt plug-in installed for MSVS, and it makes me wonder how/whether it is possible to load resources (images, etc) to the application. ...

How to acquire an event only at defined times?

I have a QWidget which handles the mouseevent, i.e. it stores the mouseposition in a list when the left mouse button is pressed. The problem is, I cannot tell the widget to take only one point every x ms. What would be the usual way to get these samples? Edit: since the mouseevent is not called very often, is it possible to increase th...

Do the Qt database modules support remote databases through a network connection?

I'm profiling some APIs to see which one is suitable for this project. I want my Qt app to connect to a database over an internet connection. Can Qt do this with the client application alone or do I need to write a server app to sit on the database server and transact the queries? ...

How to get focus of QLineEdit in Qt4.5

When i click Qlineedit i want the focus and at the same time i want to edit for multiple linedits for using virtual keyboard. ...

Invoking methods in QThread's context

In my application there's the main thread and a worker thread (QThread). From the main thread I'd like to invoke a method of my worker thread and have it run in the thread's context. I've tried using QMetaObject::invokeMethod and give it the QueuedConnection option but it's not working, I've also tried emitting signals from the main thre...

Hierachical data in TreeViews and TreeView updating technique

I have lots of (hierachical) data that I show in a TreeView (could be around 20K items or more, including children items). The peculiar problem with my data is that each object shown in the treeview can exist in many treeview items. What I mean by that is that I might have an hierarchy like this one: Item_A -> Item_B -> ItemC Item_B ->...

How to store arbitary text (including '\') in the Windows registry

I am storing some short user data strings in the Windows registry. This worked fine until one of my users tried to store a string containing a '\' character. This was then interpreted as a registry path delimiter. What is the best practice for avoiding this problem? Some sort of simple encoding? Note/ I am using the Qt QSetting class t...

Error when passing an object by reference .....

So I have a problem.... I've a method void MainWindow::loadItems(const ArticleStore& store) { } that I try to call like this inside the MainWindow class ArticleStore store(); loadItems(store) And I get this error mainwindow.cpp:15: error: no matching function for call to ‘MainWindow::loadItems(ArticleStore (&)())’ mainwindow...

Does a lock on a mutex also apply to called functions?

If a mutex is defined within a function, does its lock apply to functions called from that function? ie void f () { Mutex mutex; g(); } Does the lock still apply to any data modifications in g()? Also, am I right to say that a lock defined in a class method will only apply to specific instances of that class? Meaning: ...

Qt, Mouse skipping, not updating every pixel, mouseMoveEvent()

I working on a simple paint program. It seemed Qt (and KDE) would be a easy way to implement it. I find Qt quite easy to work with, but now I have hit a problem. When I draw something in my program the mouse skips if I move the mouse to fast. like this: It susposed to be like one long string. I'm using mouseMoveEvent() to draw a pixe...

How to follow a link in QWebKit?

Having a DOM of the following html; <a href="?op=order"> <img class="img_button" src="picture.gif" onMouseOver="this.src='some.gif';" onMouseOut="this.src='some_other.gif';" alt="" border="0"> </a> how to follow a link (href) in QWebKit (specifically QWebPage). Please notice that it's an image that is linked. I can't do it (and...

Qt WebKit Printing Shrink Factor

When printing from WebKit, it seems to automatically impose a shrink factor on the output. Is there a way to disable shrinking when printing, preferably without modifying the WebKit source? I think it may be possible using Qt 4.6 trunk and using setFixedLayout with a longer height, to trick WebKit into not shrinking, but I haven't tried...

MVC with Qt widget that uses a QAbstractTableModel subclass

Hi, I'm doing some refactoring. I'm implementing a Model-View-Controller pattern. The view is a Qt widget. Originally, the Qt widget created a new instance of a QAbstractTableModel subclass on the heap. Lets call it FooTableModel. e.g Widget::Widget(QWidget* parent) : QWidget(parent) m_model(new FooTableModel(this)) { Should I ...

QGraphicsView and QGraphicsItem: don´t scale item when scaling the view rect

Hi, I am using Qt´s QGraphicsView- and QGraphicsItem-subclasses. is there a way to not scale the graphical representation of the item in the view when the view rectangle is changed, e.g. when zooming in. The default behaviour is that my items scale in relation to my view rectangle. I would like to visualize 2d points which should be rep...

Library plans for C++0x?

Lately I've been getting very excited about the support for lambdas in VC2010. I'm slowly starting to grasp the full potential this feature has in transforming C++ into something alot better. But then I realized that this potential greatly depends on main stream support of lambdas in day to day libraries like boost and QT. Does anyone k...

How do I respond to an internal drag-and-drop operation using a QListWidget?

I've got a Qt4 application (using the PyQt bindings) which contains a QListWidget, initialized like so: class MyList(QtGui.QListWidget): def __init__(self): QtGui.QListWidget.__init__(self) self.setDragDropMode(self.InternalMove) I can add items, and this allows me to drag and drop to reorder the list. But how do ...

QT Model/View programming with complicated data structures

Greetings, I am not a professional application developer so am probably not as familiar with the model/view design pattern as I should be. Nonetheless, I am trying to use it in a hobby app and failing miserably. The primary problem I am having is that the data I am trying to display and modify is not easily represented with an extension...

What is the correct way to handle timezones in datetimes input from a string in Qt

I'm using Qt to parse an XML file which contains timestamps in UTC. Within the program, of course, I'd like them to change to local time. In the XML file, the timestamps look like this: "2009-07-30T00:32:00Z". Unfortunately, when using the QDateTime::fromString() method, these timestamps are interpreted as being in the local timezone. T...