Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • QWidget set invisible interferes with OpenGL

    1
    0 Votes
    1 Posts
    526 Views
    No one has replied
  • 0 Votes
    2 Posts
    4k Views
    T
    [quote author="terenty" date="1368515555"] In other words, if I have main .exe program (knowing nothing about Qt) with message loop and a .dll with Qt GUI and QApplication instance inside, will it be ok to let the external message loop from main .exe to handle events for Qt GUI? Thanks in advance![/quote] I'll just answer myself in case it's usefull for somebody: We have a main .exe module written in C# under .NET that runs event loop processing, and we have a couple of .dlls written in Qt/C++ that have a GUI "inside" (and a QApplication instance that is shared). QApplication::exec() is never called but all the events are successfully dispatched by the main .exe (.NET) module's event loop and all the Qt functionallity is present( signals/slots, threads, etc.) EDIT 1: That worked for Qt 4.8.2 but for Qt 5.1.0 things are a little bit different. Now you have to call QApplication::processEvents() once because it performs some initial initialization on its first call( installs WindowsHook on GetMessage or PeekMessage ). And after that whoever calls GetMessage in your application Qt events get processes and you are golden :)
  • QProgressDialog Cannot show its contents

    5
    0 Votes
    5 Posts
    1k Views
    SGaistS
    You're welcome ! If this solves your problem, you can update the thread's title to solved so other forum users may know that a solution has been found :)
  • [SOLVED] How to copy QImage into a part of another QImage

    9
    0 Votes
    9 Posts
    9k Views
    D
    [quote author="raven-worx" date="1375094384"][quote author="dolevo" date="1375093316"] Because I got the following error if I don't cast: [/quote] The error says that the method expects an value rather than a pointer. So you either allocate it on the stack (like SGaist suggested) or you pass the value of the pointer (if you need to stick to pointer): @ p.drawImage(x,y, *tmpImage); @ [/quote] I understand. Thank you very much for your detailed explanation. I appreciate it.
  • [Solved] Qt 5.1 file not downloading from web on first attempt

    6
    0 Votes
    6 Posts
    2k Views
    T
    I finally got it to work. There was a problem with consistent downloads from my original download site. Switched web sites to download from and the problem was solved. Here's the code I'm using: @ class1.h class class1: public QObject { //There's a lot more to the class, but here are the pertinent parts Q_OBJECT public slots: void onRequestCompleted(); public: QString df_url; QString df_path; QNetworkAccessManager *m_NetworkMngr; QNetworkReply *reply; public: void downloadFile&#40;const QString &url, const QString &aPathInClient&#41;; }; class1.cpp void class1::downloadFile(const QString &url, const QString &aPathInClient) { df_url = url; //class variable df_path = aPathInClient; //class variable m_NetworkMngr = new QNetworkAccessManager(this); //class variable reply= m_NetworkMngr->get(QNetworkRequest(url)); //class variable QObject::connect(reply, SIGNAL(finished()), this, SLOT(onRequestCompleted())); } void class1::onRequestCompleted() { QString url2; QString aPathInClient2; url2 = df_url; aPathInClient2 = df_path; QNetworkReply *reply = qobject_cast<QNetworkReply *>(sender()); QUrl aUrl(url2); QFileInfo fileInfo=aUrl.path(); QFile file(aPathInClient2+"/"+fileInfo.fileName()); file.open(QIODevice::WriteOnly); file.write(reply->readAll()); file.close(); }@ The downloadFile procedure parameters: url - string url of file I'm downloading aPathInClient - string location of the folder that contains the file I'm updating downloadFile gets called by a procedure that gets called by pressing a button. The entire class gets instanced with the button and then gets destroyed when the slot for the button completes. So the reply and network manager objects get destroyed when that happens.
  • [Solved] Having trouble using QMdiArea.

    3
    0 Votes
    3 Posts
    1k Views
    SGaistS
    Hi and welcome to devnet, great you found out by yourself ! Could you also update the thread's title so other forum members will know a solution has been found ? :)
  • Add/set a QCamera device

    6
    0 Votes
    6 Posts
    4k Views
    SGaistS
    You can look at the other backends too (they do things in a similar way, it's just that BB10 was one with most of the interfaces implemented when I looked at it). It's not the system specifics that will interest you but how the QCamera stuff is implemented. Simply look at the code in the camera folder, this should get you started.
  • QT 5.1.0 and Eclipse (Kepler) 32/64bit under Windows 7

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • The QPushButton clicked event in the dialog, could not call the slot

    6
    0 Votes
    6 Posts
    2k Views
    Z
    The program have a slot named loginBtnSlot in LoginDialog . The console output has no error about the signal-slot-connection problems. When I use the statement: @ QMetaObject::Connection conn = connect( mpLoginBtn, SIGNAL(clicked()), this, SLOT(loginBtnSlot()) ); if( conn ) { qDebug() << "conn is ok."; } @ It can output "conn is ok.". I add these statements below afterwards, then found that everything was all right. @ QPushButton *pCancelBtn = new QPushButton( tr("Cancel"), this ); connect( pCancelBtn, SIGNAL(clicked()), this, SLOT(reject()) ); @
  • Convert QString to unsigned char

    3
    0 Votes
    3 Posts
    8k Views
    L
    Check the FAQ: "How can I convert a QString to char* and vice versa?":http://qt-project.org/faq/answer/how_can_i_convert_a_qstring_to_char_and_vice_versa
  • Why show() makes message box modal?

    6
    0 Votes
    6 Posts
    3k Views
    D
    Hi, the first paragraph of QMessageBox's documentation says that: bq. The QMessageBox class provides a modal dialog for informing the user or for asking the user a question and receiving an answer.
  • How to set QTreeview.width == MainWindow.width

    3
    0 Votes
    3 Posts
    2k Views
    X
    Thanks, I didn't see that.
  • OpenGL pre-defined modelling Kit

    3
    0 Votes
    3 Posts
    1k Views
    T
    You probably mean "Qt3D":http://qt-project.org/wiki/Introduction-to-Qt3D which provides loading scenes and meshes from different file formats etc. You can get it from http://qt.gitorious.org/qt/qt3d
  • How to avoid losing mouse events?

    3
    0 Votes
    3 Posts
    2k Views
    M
    Maybe you want to use c), but also coalesce the events in order to limit the number QPixmap updates in the "main" thread. That is: If several events are encountered within a short time, update the QImage in the "background" thread for each event, but only trigger an update of the QPixmap once. A simple solution would be to simply delay the signal that is sent from the "background" thread to the "main" thread. That is: If the background thread processes an event, it starts a timer. If the timer is triggered, the signal will be sent. But if a new event is encountered before the timer was triggered, stop the timer, process the new event and re-start the timer. There also should be a limit of the maximum overall delay, of course...
  • QListView and etc.

    3
    0 Votes
    3 Posts
    855 Views
    H
    I already found the solution, thanks. All i needed is just scroll by pixel instead of scrolling by element.
  • Qt 5: Error : cannot make OpenGL Context current in a different thread

    1
    0 Votes
    1 Posts
    3k Views
    No one has replied
  • [SOLVED] do we need to free QstandardItem and QstandardItemModel ?

    4
    0 Votes
    4 Posts
    1k Views
    X
    i just found the answer on QStandardItemModel :-) yes we should delete it using slot deleteLater(); have a look on: "Link1":http://qt-project.org/doc/qt-4.8/qabstractitemview.html#setModel "deleteLater()":http://qt-project.org/doc/qt-4.8/qobject.html#deleteLater
  • Where is Graphics View framework in Design mode?

    9
    0 Votes
    9 Posts
    3k Views
    sierdzioS
    That depends very much on what you have installed :) Qt Creator is just an IDE, so you need Qt libraries too. But recent Qt Project downloads (Qt > 5.0) are actually an SDK that includes everything: Qt Creator and Qt libraries.
  • Path or permissions wrong?

    3
    0 Votes
    3 Posts
    1k Views
    A
    Yes I am. Hoping to resolve this issue I have installed qt-windows-opensource-5.1.0-msvc2012_opengl-x86_64-offline, since I have msvc2012 express, but to no avail; I keep getting the same error message. Starting D:\ArbolOne\dev\QT_untitled\build-untitled01-Desktop_Qt_5_1_0_MSVC2012_OpenGL_64bit-Debug\debug\untitled01.exe... Failed to start program. Path or permissions wrong? D:\ArbolOne\dev\QT_untitled\build-untitled01-Desktop_Qt_5_1_0_MSVC2012_OpenGL_64bit-Debug\debug\untitled01.exe exited with code -1 Why is Qt soooo difficult to install on Windows? What are the limitations the engineers are having there that has force them to do a half bad job with this beautiful toolkit. Look people, in all reality you are performing very poorly, even much lower quality toolkits are dong better, GTK and gtkmm are just an example. One only needs to install the toolkit and poom! plug and play! that's it. It is TV dinner to have this packages plug to our current applications. I would not recommend anyone using Windows to even try that garbage toolkit, but I would recommend you to have a quick look at how they make the usage of it soooooooo simple. @#include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; }@
  • Mac menu conventions changed in Qt 5.1.0

    5
    0 Votes
    5 Posts
    2k Views
    K
    Good tip, thanks.