Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.8k Posts
  • Help with setFieldWidth in QTextStream

    3
    0 Votes
    3 Posts
    4k Views
    L
    Thanks for the info! :)
  • [Solved] QLabel->showFullScreen() on multiple monitors

    3
    0 Votes
    3 Posts
    5k Views
    O
    Thanks! Solution to those that find their way here: @ q_label_to_show->setGeometry(QApplication::desktop()->screenGeometry(screenID)); q_label_to_show->showFullScreen(); @ [Edit: Added @ tags; mlong]
  • How does qHash(QStringRef&) work?

    3
    0 Votes
    3 Posts
    2k Views
    Z
    Nice! Thanks!
  • Qt Applications using the serial port?

    3
    0 Votes
    3 Posts
    8k Views
    K
    Note: For QtSerialPort also added support/compliant to the Qt4.
  • QDialog Embedded in QWidget

    2
    0 Votes
    2 Posts
    2k Views
    L
    From my experience this is not possible because a QFileDialog is based on "QDialog":http://qt-project.org/doc/qt-4.8/QDialog.html and QDialog is not intended to be displayed as widget inside another widget, but as a top-level window on its own. I don't know about the internals of QFileDialog but maybe it is possible to subclass QFileDialog and expose the internally built widget so you could use it as "stand alone" widget.
  • [SOLVED] Qt application DAMAGES its toolbar/menu ICONS after some time...

    14
    0 Votes
    14 Posts
    5k Views
    M
    Well, it looks like I have spotted eventually the culprit for this effect. I had to replace the driver for my graphics card (NVS 290) with NVIDIA's proprietary driver due to a problem with the noveau driver. The latter actually caused quite a few system hangs! After the driver change the icon-damaging did not appear anymore. NOVEAU was responsible for both problems.
  • Display problem with QCheckBox

    4
    0 Votes
    4 Posts
    3k Views
    A
    In that case, I would create a custom delegate that renders (only) the checkbox in the center of the cell instead. That really isn't all that hard to do.
  • Converting to execution character set: Illegal byte sequence Erorr ?!!!

    4
    0 Votes
    4 Posts
    7k Views
    A
    i update my mingw but take the same error ! please help me
  • [Solved] advance to next page would not work in the last page of wizard

    5
    0 Votes
    5 Posts
    5k Views
    D
    I think I made some stupid mistake. The accept() works well. Maybe there was something wrong with my environment. The reason that the next() does not work with the final page is the return value of nextId(). @ void QWizard::next() { Q_D(QWizard); if (d->current == -1) return; if (validateCurrentPage()) { int next = nextId(); if (next != -1) { if (d->history.contains(next)) { qWarning("QWizard::next: Page %d already met", next); return; } if (!d->pageMap.contains(next)) { qWarning("QWizard::next: No such page %d", next); return; } d->switchToPage(next, QWizardPrivate::Forward); } } } @ If the return value of nextId() was -1, It would not do anything. Just like the QWizard reference said: This is equivalent to pressing the Next or Commit button. Clicking the finish button is not the same as next button
  • I need some help with a QStringList, please??

    7
    0 Votes
    7 Posts
    3k Views
    W
    Well, if i've understood you right, you want to check all combinations of login and password, i.e. n*m variants, where n is number of logins and m is number of passwords. If so, you're doing it in a wrong way, you should: @ else if (!username.isEmpty() && !passcode.isEmpty()) { for (int i = 0; i < sUsername.count(); j++) for (j = 0; j < sPasscode.count(); j++) { if ((username == sUsername[i]) && (passcode == sPasscode[j])) { // You are successfully logged on to the program ui->nameEdit->clear(); ui->codeEdit->clear(); QMessageBox::information(this, tr("Login Screen"), tr("You have successfully logged on to this program!")); } else { QMessageBox::information(this, tr("Login Screen"), tr("Sorry but that was an invalid username or passcode.\nTry again...")); } } } @ But I don't understand the meaning of this procedure: if you want to authenticate user, then you should check that he entered correct password for some correct login. Something like: @ else if (!username.isEmpty() && !passcode.isEmpty()) { if (users.count(username)) { if (passcodes[username] == passcode) { QMessageBox::information(this, tr("Login Screen"), tr("You have successfully logged on to this program!")); } else { QMessageBox::information(this, tr("Login Screen"), tr("Sorry but that was an invalid passcode.\nTry again...")); } } else { QMessageBox::information(this, tr("Login Screen"), tr("Sorry but that was an invalid username.\nTry again...")); } } @
  • FAILED compile for arm.v5.udeb.gcce4_4_1 error

    7
    0 Votes
    7 Posts
    3k Views
    G
    hi tobias hunger. i am using qt sdk 1.2. it is based on qt 4.7.4. also, to download qt sdk 2.4, i have followed this link: "releases.qt-project.org/qtcreator/source/qt-creator-win-opensource-2.4.1.exe". while installation, it does not highlight the option to install install qt sdk.
  • MapToSceneDistance() needed?

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Resize layout and buttons contents

    2
    0 Votes
    2 Posts
    3k Views
    J
    To do this thing, I think you should introduce your own @QPushButton@ derived custom widget. In constructor, call @QWidget::setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding))@ to show it first time in a as best size as possible but fully expandable. (note: do not use QSizePolicy::Ignored. this will make button lost its best size). call @QWidget::setMinimumSize(QSize(1,1))@ to be shrinkable. In overrided @virtual paintEvent(QPaintEvent* e)@, get the best font size QFontMetricsF. search forum or google, you can find a example to get the best font size to fit a specific space. draw the button text your own. That's it. If i were you , I'd not use text but use image which is easier to draw fully covered on widget area in this case.
  • Thread-safe subclass of QStandardItemModel?

    6
    0 Votes
    6 Posts
    6k Views
    J
    Before you go further to implement 'diff' thing(and/or Gerolf's advice), just let your worker thread invoke model's member asynchronously using Qt event system. Unlike win32's event pumping system, it doesn't lose any event even if lots of events are queued(this is my own experience though only in Windows xp). Not every time model data is updated, view is updated forcefully. All GUI updates will handled in compact'ed way in Qt like any other UI toolkit/API. After finishing this simpler approach, check performance and then go further to introduce a good kinda proxy class like the one Gerolf advised. I'd do things like this. Using MFC and Qt simulateneously, it is quite easy to make any mistake when handling intra-thread implementation(MFC has its own thread context data and quite often assuming that other thread has it too). I would keep things simple as much as possible. I'd be happy to hear another your updates on this implementation. Cheer up. [quote author="samapico" date="1336055661"]I'm not quite sure to understand this right... Even if my entire application was Qt, how would this work? I understand that interacting with a model through a view goes through the UI thread... but what if another thread wants to manipulate the model? It will call methods of the model directly in its own thread, no? [quote author="joonhwan" date="1336006658"]It sounds like you're using MFC migration framework(I also use it in my work). Because MFC worker thread is not Qt thread, you will not use signal in that worker thread, AFAIK. Maybe you will have to use QObject::metaObject() to get QMetaObject and call its invokeMethod() to call the final mem func. BTW, unlike MFC and other win32 gui, Qt can use UI object in only one thread(the main thread). Make gui operation atomically would not help in that case(at the end of any operation you should call syn method like QWidget::update() ...). In Qt way, you have to separate your logic and gui with signal and slots. [/quote] I think one of my issues is that some of the operations on my model involve multiple deletes and inserts, and I might be emitting a lot of 'dataChanged' signals... Is there some way to tell the model to stop updating connected views during a long operation, and emit a single 'dataChanged' at the end? Do I need to inherit from QAbstractItemModel instead to do that? As Gerolf said, I'd get much more liberty and control over thread safety, but it involves some pretty heavy refactoring :([/quote]
  • Panel (hide/show)

    7
    0 Votes
    7 Posts
    9k Views
    B
    It has a lot of code and I can not find.
  • Writing audio output from an internally generated stream from a thread?

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • How to abort all the requests of the QNetworkAccessManager

    6
    0 Votes
    6 Posts
    8k Views
    C
    hi again... getting the same issue as before again. have a look at this question: http://stackoverflow.com/questions/10440431/abort-reply-crashes-with-access-violation for more info. i have no idea what to do. the disconnect worked some times...
  • Update question

    5
    0 Votes
    5 Posts
    2k Views
    A
    ummm tnx but do you have article about of ? how can i learn ?
  • Problem with displaying % sign in a QString

    3
    0 Votes
    3 Posts
    2k Views
    P
    Hi RS, Just an FYI, use code tag while writing code in post for better readability. (right most symbol on post area) @//JustAnExample processMemUsedLabel->setTextFormat(Qt::RichText); QString testStr = QString(“Used Mem”) + QString(QChar(’%’)); processMemUsedLabel->setText(testStr);@
  • Unable to find drivers for msyql.

    4
    0 Votes
    4 Posts
    2k Views
    A
    I'm sorry, I must have totally misread your post.