Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • Get QSharedPointer's Reference Count

    3
    0 Votes
    3 Posts
    4k Views
    G
    Wow, cool. I was just implmeneting my own atomic int. Didn't know there was a class in Qt. So should I inherit from QSharedPointer and in every constructor and copy constructor increase the count; and then decrease the count in the desctructor?
  • Detecting MouseClick on free area on screen

    5
    0 Votes
    5 Posts
    2k Views
    T
    I don't know Qt for Embedded Linux.... But you can try put buttons invisible (or a group - another "blank" window?) before start the video.
  • Symbol(s) not found

    3
    0 Votes
    3 Posts
    1k Views
    P
    I just installed XCode 3.2.2 to combat this issue. What's the default location of the stdlib library? I can't seem to find any .lib to add. Thanks
  • Any good book for QT

    5
    0 Votes
    5 Posts
    8k Views
    L
    [quote author="sierdzio" date="1350803550"]This is the standard one: "C++ GUI Programming with Qt 4":http://qt-project.org/books/view/c_gui_programming_with_qt_4_2nd_edition_the_official_c_qt_book. It's a bit outdated by now, but most information is still valid, and it's really well written. Very good for an initial introduction, and it also includes some more advanced knowledge towards the end.[/quote] +1 :) deepaksinghkushwah, why don't you have a look at the summary of "all books at Qt Dev Network":http://qt-project.org/books and select the most interesting and appropriate book for your needs?
  • QtMultimediaKit QtMobility

    13
    0 Votes
    13 Posts
    8k Views
    JKSHJ
    Qt doesn't natively support many multimedia formats. If you want that, you should use a 3rd-party library -- if you link libVLC to your project, you can play all the formats that VLC media player can play.
  • QtQuickView showFullScreen method on osx broken?

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • How to change my GUI Base Class (QWidget => QMainWindow) ?

    14
    0 Votes
    14 Posts
    24k Views
    U
    Ok, Thanks guys. Andre's method worked (with some more work to copy past the code from my QWidget to the new QMainWindow)
  • Qt request never trigger the finished() signal

    9
    0 Votes
    9 Posts
    5k Views
    U
    So i guess i will need to buid my own thread pool?
  • QMYSQL driver not loaded

    4
    0 Votes
    4 Posts
    3k Views
    J
    I found this site that helped me to build the plugin: http://ieatbinary.com/2011/07/11/how-to-enable-mysql-support-in-qt-sdk-for-windows/ I put the dll files into the C:\QtSDK\Desktop\Qt<version>\mingw\plugins\sqldrivers but still Qt says it can't find the driver. :/
  • Background color in StackedWidget

    16
    0 Votes
    16 Posts
    9k Views
    B
    I don't think so. If it is too big you can maybe shape it down to just the QStackWidget parts.
  • Error: no such slot while using QNetworkAccessManager with threads

    10
    0 Votes
    10 Posts
    6k Views
    JKSHJ
    Here's an example. I can fill in the form 100 times, and download 100 different websites, while using the same QNetworkAccessManager. @ class ProgramCore : public QObject { private: Q_OBJECT MainWindow *gui; QNetworkAccessManager *manager; private slots: void getPage() const { QNetworkRequest req; req.setUrl(QUrl("My url")); QByteArray postData = gui->readFormData(); // Connect the signal from the reply, not from the manager. // The QNetworkReply will download data in the background. Your GUI is free // during this time. QNetworkReply *reply = manager->post(req, postData); connect(reply, SIGNAL(finished()), this, SLOT(processReply())); } void processReply() const { // Use QObject::sender() to find the object that emitted the signal QNetworkReply *reply = qobject_cast<QNetworkReply*>(this->sender()); QString answer = QString::fromUtf8(reply->readAll()); qDebug () << answer; // Make sure you don't have a memory leak! Delete the object when you've finished reply->deleteLater(); } public: ProgramCore(QObject *parent = 0) : QObject(parent) { this->gui = new MainWindow(this); this->manager = new QNetworkAccessManager(this); connect(gui, SIGNAL(userSubmittedTheForm()), this, SLOT(getPage())); } } @ Final notes: This is just Repetition, not "Indirect Recursion". You only wanted to repeat a task, so you shouldn't use threads to do that. Threads are for Parallel Processing -- for example, making 2 CPU cores process different data at the same time.
  • Custom qtreeview

    2
    0 Votes
    2 Posts
    3k Views
    B
    If you can use QTreeWidget the following should work. QTreeWidget is a subclass of QTreeView so everything the widget can, the view also is able to but maybe with a bit more programming effort. You can use @ item = new QTreeWidgetItem(); tree->addItem(item); @ to add a new item to the tree. By giving a parent you can build your hierarchy. After that you can set your own widget for the item with @ tree->setItemWidget(item, 0, new MyWidget()); @ I am not sure which methods you can use with the QTreeView but as I wrote before you can write all of them yourself if necessary. You can get you widget back with @ QList<QTreeWidgetItem *> selected = tree->selectedItems(); //or if you want to use the mouse pos tree->itemAt(x, y); @ EDIT You use the flags to make the items editable or whatever: @ item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); @ Be aware that for example if you parent item is not enabled you cannot select the child for example.
  • What is QtitanMultimedia

    2
    0 Votes
    2 Posts
    904 Views
    M
    There is an overview of the product at "this link.":http://www.devmachines.com/qtitanmultimedia-overview.html To use these classes, you need to purchase a license from Developer Machines, though I believe they have a free trial available.
  • How to clone a project ?

    3
    0 Votes
    3 Posts
    3k Views
    T
    The preferred way is of course to create a fresh checkout from your version control system. With distributed version control systems like git, bazaar and mercurial (all supported by creator) you do not even need to set up a server somewhere! You should be using one, even if you work alone!
  • Cannot disconnect server child client

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • CloseEvent problem for early closures and a lenghthy constructor

    2
    0 Votes
    2 Posts
    1k Views
    B
    What exactly is the problem with that? What are you doing in your constructor? Did you try to block the signals until it is finished?
  • 0 Votes
    7 Posts
    6k Views
    D
    My issue is not related to what you say since my network manager is a member a class in my code and is not declared on the stack the issue is a Bug in QT 4.8.1 which as been resolved in 4.8.3. Plus me the code wasn't just not sending signals or slots it complety crashed my application. [quote author="okachobi" date="1350329767"]I arrives at this post while searching for a problem I was having with QHttpMultiPart not working. It simply was not making the post and never calling any of the signal handlers. I have since figured out the problem, and wanted to drop some breadcrumbs here for anyone else who is in a similar situation. The code snipped in the 4.8 QT manual will not work if cut and paste into a method. It mentions connecting the signals to your slots at the end as if the author of the snippet intended for it to be used in an event driven app, but they declared a local QNetworkAccessManager that will fall out of scope if a method returns and it will never complete the post. They even reparented the file and the multipart objects as if it was a snippet ready to be pasted into a method. It took me forever to find this problem because those things were misleading. Indeed, the QNetworkAccessManager should be allocated dynamically and parented to your own class so as not to fall out of scope. In the code snippet, it is declared on the heap and would delete itself after you setup the signals and return. You must allocate it dynamically and parent it to your own object, or make it a member variable that you manage. Do not use the declaration as it is written. I can't imagine how they arrived at the code snippet in the documentation unless it was a console application that busy-wait polled the status of the reply, but then they wouldn't have suggested connecting to signals to your own slots, so its very misleading. [/quote]
  • Detect end of movement of QMainWindow / QDialog (Qt 4.8)

    12
    0 Votes
    12 Posts
    7k Views
    T
    I finally made it with the timer, not the smoothest solution in this world, but it works. In this example I have to reposition the widget if it lays across multiple screens at the end of the movement. @ #include "STMultiScreenMovementManager.h" #include <QDesktopWidget> /** Constructor. @param parent: Widget under control. / STMultiScreenMovementManager::STMultiScreenMovementManager(QWidget parent) : QObject() { this->parent = parent; timer = new QTimer(this); QObject::connect(timer, SIGNAL(timeout()),this,SLOT(adjustPosition())); } STMultiScreenMovementManager::~STMultiScreenMovementManager() { DELETE_P(timer) } /** Called by the moveEvent in the parent widget. */ void STMultiScreenMovementManager::notifyMovement(){ if(!timer->isActive() && intersectsScreenBounds()){ timer->start(100); } } /** Called upon timeout: it adjusts the widget position if the current one is not permitted. / void STMultiScreenMovementManager::adjustPosition(){ QDesktopWidget dw = QApplication::desktop(); QPoint endingPos = calculateEndingPosition(); if(parent->pos() == endingPos || dw->screenGeometry(parent).contains(parent->frameGeometry())){ timer->stop(); }else{ parent->move(endingPos); } } /** This method calculates the nearest right position for the widget. */ QPoint STMultiScreenMovementManager::calculateEndingPosition(){ [........] return endingPos; } /** This is used to find out if the widget is laying across multiple screens. */ bool STMultiScreenMovementManager::intersectsScreenBounds(){ [......] return true/false } @
  • How to update a QTableWidget row by row

    3
    0 Votes
    3 Posts
    3k Views
    M
    Glad you figured it out! Be sure and add [Solved] to your thread title in the initial post. Thanks!
  • Filter filename in QDialog

    14
    0 Votes
    14 Posts
    6k Views
    B
    AFAIK and without RTFM the name of the actual file (project1.cst) or the pattern (*.exe) must be enclosed by brackets.