Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.9k Posts
  • QSortFilterProxyModel/QTableView

    3
    0 Votes
    3 Posts
    5k Views
    G
    You can add your own methods to your sort filter proxy model subclass. Those can take the double values as you need them, eg. @ setFilterGreaterThanOrEqual(double lowerBound); setFilterRange(double lowerBound, double upperBound); @ and so on. Internally you can set a state variable that determines which comparisons to execute. Then you need to reimplement filterAcceptsRow() accordingly. The setFilterXXX can be used, but are ignored in your case.
  • 0 Votes
    3 Posts
    14k Views
    A
    Thanks a lot! saved me a lot of code
  • How to hide row numbers in Qtablewidget

    4
    0 Votes
    4 Posts
    18k Views
    A
    thanks! it was pretty simple
  • After MySQL driver installation now also I am facing problem

    4
    0 Votes
    4 Posts
    2k Views
    C
    Copying files around or from another machine before you understand why it is failing is just thrashing around in the dark. There's nothing wrong with the library. It just appears to be in a place that is not usually on the path searched by the system for libraries. Before you try fixing this permanently, try running your example with this command line: @LD_LIBRARY_PATH=/usr/lib/i386-linux-gnu ./sqlexample@ Does it work? If so, read the man page for ldconfig to see how to make it permanent.
  • [SOLVED] Embedded QMainWindow-deriven widget in application

    7
    0 Votes
    7 Posts
    4k Views
    S
    Nicely works You saved my day, again ;) Thanks
  • [Solved] Showing QMenu in QListView

    4
    0 Votes
    4 Posts
    3k Views
    P
    Thank You very much! I have no idea how I missed this in documentation. Solved!
  • Playing mp3 in a loop using Phonon

    3
    0 Votes
    3 Posts
    4k Views
    A
    I tried to execute this code on another PC and it's work as I planing. It plays in a loop. But on my PC it plays only one time. All my PC and other use Windows XP Sp3 but I installed K-Lite codec pack on my PC.
  • How keep connection with MySQL Server 5

    2
    0 Votes
    2 Posts
    2k Views
    C
    Your code has nothing to do with losing a connection. It's only creating a connection and either succeeding or failing. If an existing connection is lost between your machine and the server then queries will start failing. The QSqlQuery::lastError() call should return an error of type QSqlError::ConnectionError. You can also periodically check QSqlDatabase::isOpen(). Since you are using MySQL you can also use the MYSQL_OPT_RECONNECT in QSqlDatabase::setConnectOptions() to automatically attempt reconnection (it might still fail). How you recover, if possible at all, is dependent on your application. If you have been working inside a transaction the server has probably already rolled back the transaction so you need to recover at that point in your application's processing.
  • Color picking with QT in openGL

    6
    0 Votes
    6 Posts
    5k Views
    M
    If you get always black screen then color you 'pick' will be always black. Try changing the camera position.
  • How to get row and column in QTablewidget?

    4
    0 Votes
    4 Posts
    11k Views
    S
    hi, try this @ connect(ui->tableWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(getText())); // or connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(getText())); @ and @ void tableDialog::getText(){ QString text; text = ui->tableWidget->item(ui->tableWidget->currentRow(), ui->tableWidget->currentColumn())->text(); } @
  • How to force layouts to recompute under Qt 3

    2
    0 Votes
    2 Posts
    2k Views
    G
    If I remember correctly, something of a combination of calling update() or adjustSize() on the widget and/or calling invalidate() on the toplevel layout of the widget triggers a recalculation of the needed size.
  • Trouble changing selection mode for a QTableWidget

    2
    0 Votes
    2 Posts
    3k Views
    G
    You're mixing behavior and mode: setSelectionBehavior() takes on of "this values":/doc/qt-4.8/qabstractitemview.html#SelectionBehavior-enum (items, rows, columns). You want to call setSelectionMode(), which takes, among QAbstractItemView::NoSelection, "those values":/doc/qt-4.8/qabstractitemview.html#SelectionMode-enum.
  • 0 Votes
    3 Posts
    2k Views
    M
    Oh, you would obviously want to use @ event->modifiers() & Qt::ControlModifier @ Sorry.
  • Reading file

    5
    0 Votes
    5 Posts
    28k Views
    G
    [[Doc:QFile]] has a method seek() and and a method read() that takes a length parameter.
  • Drag and drop .exe to create icon bar

    4
    0 Votes
    4 Posts
    2k Views
    G
    dragEnterEvent, dropEvent etc. are methods of QWidget, so in principle, you can use that everywhere. Some of the more advanced widgets provide some default implementation for drag/drop with some more advanced API. The item view classes like [[Doc:QTreeView]] or [[Doc:QTextEdit]] come into mind here.
  • Mixing C and C++/Qt code

    3
    0 Votes
    3 Posts
    6k Views
    G
    Welcome to the forums. Some housekeeping first: wrap code in @-tags or use the editor's button. It makes your code look nicely and adds some pretty printing. I've added them for your, but please format yourself next time adding your question to quite old threads (the "original thread":http://qt-project.org/forums/viewthread/10975/ dates back to October last year) isn't that useful, better open a new thread with a decent topic. I've split your question off to a new thread for that reason. begging for private answers usually leads you to no answers at all. This is a public forum, with everyone answering in their spare times. We do not do private support. Read http://www.catb.org/~esr/faqs/smart-questions.html for some explanations Regarding your actual question: The sum.h header file is plain wrong. Use this one @ #ifndef SUM_H #define SUM_H #ifdef __cplusplus extern "C" { #endif int mySum(int a, int b); #ifdef __cplusplus } #endif #endif // SUM_H @ And then make sure that your sum.c implementation file is actually added to the list of source files and gets compiled and linked to your application.
  • Overriding QDir::homePath()

    17
    0 Votes
    17 Posts
    9k Views
    G
    [quote author="lwcorp" date="1337853314"]Please answer: bq. But what advantage does SHGetFolderPath() offer? Can it easily be bypassed?[/quote] Advantage: it is official API, although deprecated. But as Andre already mentioned, as long as Qt is running on XP, one will have to use it, as the replacement isn't there. Bypassing: I don't know, as I never had a need to do this.
  • [self SOLVED]using QTest::qExec() with parameters

    2
    0 Votes
    2 Posts
    3k Views
    S
    Finally after doing some search and thinking I am able to run QTest::qExec() with parameters. I am able to save the test results in different files both in .txt format as well as xml format. I got the following code working for my requirements For output as a file @QStringList testCmd; QDir testLogDir; testLogDir.mkdir("UnitTest_Results"); testCmd<<" "<<"-o" <<"UnitTest_Results/test_log.txt"; QTest::qExec(myTestClass,testCmd);@ For xml output: @testCmd<<" "<<"-xml" <<"-o" <<"UnitTest_Results/test_log.xml"; QTest::qExec(myTestClass,testCmd);@ The above code is just for running a single testClass. But i am running multiple testClasses and writing the test output to the respective files.
  • About Demo "calculator" : where to get display.png? -- solved

    4
    0 Votes
    4 Posts
    2k Views
    EddyE
    You're welcome. Could you please edit your first post and add [solved] to the title? Thanks.
  • [Solved] How to get the list of functions in a dll -Unit testing

    7
    0 Votes
    7 Posts
    20k Views
    S
    Finally I got my code working with a different approach. I created a wrapper class that subclasses my interface and all my testClasses register's to the AutoTest. Also the interface class provided the list of testClasses. Thanks for your time :)