Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.9k Posts
  • [SOLVED] Cannot open header file c32comm.h

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Custom table model is not working...

    6
    0 Votes
    6 Posts
    3k Views
    A
    Thanks a lot for your detailed explanation...ya i'll try using table widget itself... and will come back to u if i face any more issue...:)
  • How to choose Base Class?

    4
    0 Votes
    4 Posts
    7k Views
    W
    [quote author="saobien39" date="1336962017"]I wonder ... is there any sign about future program that we decide for using base class?[/quote] If you don't want to hear an answer then why do you ask question? Also it's easy to see, that QMainWindow class was designed to be ... hm ... base for main window in applications. While QDialog is designed to be base class for different kind of dialogs. These classes have different default controlls. For example, QDialog class have only close button and help button. Of cause, you can change it, but it's silly. About QWidget. AFAIK it's the base class of both QMainWindow and QDialog, but if you don't need any special functionality, you don't need to use it as main window base class. Just because you're learning now. Of cause later you may do it, but now it's not reasonable.
  • SQLite do not store a BLOB data.

    8
    0 Votes
    8 Posts
    11k Views
    C
    Thank you for your expansive reply. Did you run the simple query I asked? Here's a complete working example @ // main.cpp #include <QtCore> #include <QtSql> #include <QDebug> int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); QByteArray data; QFile file&#40;"main.cpp"&#41;; if (file.open(QIODevice::ReadOnly)) data = file.readAll(); qDebug() << "Original data" << data.size() << "bytes"; QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName(":memory:"); if (db.open()) { QSqlQuery qry(db); qry.prepare("CREATE TABLE test (id INTEGER PRIMARY KEY, size INTEGER, data BLOB)"); if (!qry.exec&#40;&#41;) qWarning() << qry.lastError(); // Insert some blob goodness qry.prepare("INSERT INTO test (id, size, data) VALUES (?, ?, ?)"); for (int i = 0; i < 5; ++i) { qry.bindValue(0, i); qry.bindValue(1, data.size()); qry.bindValue(2, data); if (!qry.exec&#40;&#41;) qWarning() << qry.lastError(); // make the blob grow for some variety data += data; } // Now let us get them back qry.prepare("SELECT id, size, data FROM test"); if (qry.exec&#40;&#41;) { while (qry.next()) { qDebug() << qry.value(0).toLongLong() << qry.value(1).toLongLong() << "stored" << qry.value(2).toByteArray().size() << "bytes retrieved"; } } else qWarning() << qry.lastError(); } return 0; } @ If that works (and it will) then the problem is elsewhere in your code. The size of file you are writing to the database, and the actual size of the byte array of data may never have been the same The stuff at the end about "receiving bytearray" has nothing to do with your thread title and question. However, incorrectly handling network data is a common way to not have the compete file contents you think you have. The usual mistake is to assume that all the data arrives at the same time.
  • Multichannel Audio Output using QAudioOutput

    1
    0 Votes
    1 Posts
    3k Views
    No one has replied
  • [SOLVED] (beginner) Calling a function from another class ?

    6
    0 Votes
    6 Posts
    23k Views
    ZlatomirZ
    While waiting for those books you can search for Thinking in C++ there are two volumes written by Bruce Eckel and are available as free download. //my opinion is that you will need some C++ knowledge to read Stroustrup's book (because C++ programming language is not exactly for beginners, he has another book for beginners called "Programming - principles and practice using C++":http://www2.research.att.com/~bs/programming.html)
  • Get QT Creator running with OpenGL ES2.0 using environment variables

    2
    0 Votes
    2 Posts
    2k Views
    M
    I use glew and setup my build like so: @QT += opengl win32|linux-g++|linux-g++-64 { LIBS += -lGLEW DEFINES += BUILD_DESKTOP USER_INTERACTION message(Desktop build) } else { DEFINES += BUILD_DEVICE message(Device build) }@
  • 0 Votes
    9 Posts
    8k Views
    W
    I investigated this signal transfer thing a little bit more. I created a subclass of QTreeView and reimplemented its dataChanged to print some debug output (in addition to set the data). Then I experienced the following (connecting different proxies between a simple QStandardItemModel and this view): QAbstractProxyModel does not forward dataChanged signal: I created a minimal subclass of QAbstractProxyModel, specifically a naive implementation of QIdentityProxyModel. I implemented only the pure virtual methods and the proxy transferred all data without loss (and dataSet requests too!), but the debug output was never come. QIdentityProxyModel and other predefined proxy models really transfer this signal, I got the debug output if I used any of them. I know that the suggested practice is to subclass QIdentityProxyModel instead of QAbstractProxyModel. Also for those who must use an older version than Qt 4.8.0 (like me) it is clearer to subclass QAbstractProxyModel instead of QSortFilterProxyModel for some specific reason. So I think I will (if I can) add a note on this in the docs because it's (in my opinion) a good-to-know thing. Thank you again for this discussion. I'll mark this thread [solved], but I kindly welcome your further notes, remarks or ideas.
  • [SOLVED]QtCore4.dll missing entry point

    3
    0 Votes
    3 Posts
    27k Views
    ZlatomirZ
    Most likely you copied the wrong QtCore4.dll - by wrong i mean built with a different compiler that the one you built your application, have you copied it from: SDK_INSTALL_DIR\Desktop\Qt\4.8.1\mingw\bin? There is another one in SDK_INSTALL_DIR\QtCreator\bin this is used by Creator and it's built with visual studio (at least this was some time ago and i don't think it changed)
  • Count the number of film instances

    10
    0 Votes
    10 Posts
    4k Views
    P
    Man... your errors are all because of the ; missing after class declaration in Film.h. The "two or more data types in declaration of 'main'" is like you are declaring your main as: Filme int main(int argc, char *argv[]) If you put the ; after class declaration all errors disappear.
  • How to create Qt apps (VS2008) ?

    5
    0 Votes
    5 Posts
    2k Views
    S
    It's first time I've listened about VS add-in, I was corrected problem. Thanks favoritas37, thanks everyone.
  • Put an item on the QGraphicsView

    5
    0 Votes
    5 Posts
    2k Views
    S
    Yes this is very common mistake, even i got confused initially when using the graphicsView. Kindly Edit your first Post and mark it [SOLVED], Happy Coding !!!!
  • Work with QTabWidget

    11
    0 Votes
    11 Posts
    15k Views
    L
    QTabWidget::tabBar() (and thus QTabBar::setTabTextColor()) is protected, so you'll need to subclass QTabWidget in order to make it publicly available. @ class TabWidget : public QTabWidget { public: TabWidget(QWidget *parent = 0) : QTabWidget(parent) {} void setTabTextColor(int index, const QColor &color) { tabBar()->setTabTextColor(index, color); } }; ... TabWidget *tabWidget = new TabWidget; tabWidget->setTabTextColor(0, Qt::red); @
  • How to display a splash screen in Qt ?

    20
    0 Votes
    20 Posts
    30k Views
    E
    Hello, KA51O and MuldeR This is a link to the splash page code I was modifying, here you will find a sample application created using the display splash page method. See if you can compile this and run it on your computer and tell me what you think about it. http://entricularresearchprojects.comyr.com/myprojects.htm
  • IntelliSense behaviour in a QTextEdit...

    5
    0 Votes
    5 Posts
    3k Views
    I
    LOL, I know.... and also known as "smart code completion" :-)
  • Experience with QTimer and long time spans

    5
    0 Votes
    5 Posts
    5k Views
    D
    [quote author="gandiii" date="1336748880"]this application should be a controller for a weather station and should run "endless".[/quote] Oh that's nice. Our measurement stations (not weather though) have crashed regularly in the first years of development. Do you plan to implement remote firmware/software updates? If not, happy hiking with a screwdriver every evening ;). If yes, good, then you'll need persistent timed events, though.
  • QtCreator part 3 tutorial

    3
    0 Votes
    3 Posts
    2k Views
    D
    I guess it is assumed the very basics of C++ are known, in this case how forward-declaration works and what it's good for. If you're new to (C++)programming, I tend to discourage starting with Qt right away. While Qt is a great role model for clean programming/naming/API design (I myself have learned a lot from the Qt wizards), it uses some quite tricky mechanisms that are way over the head of new programmers, and may distract from actually learning C++ (Meta object RTTI/MOC, qmake, Signals&Slots, pimpl, the whole event loop system, the different ways of memory management). The STL is more down to earth regarding those things. And as a bonus, after learning to walk with C++ and STL a little, you'll appreciate Qt much more and feel like flying.
  • Setting Header Data with QSqlQueryModel does not work

    2
    0 Votes
    2 Posts
    3k Views
    D
    Make a QAbstractProxyModel or QSortFilterProxyModel which only reimplements headerData() to return the header strings you want. All other stuff shall be forwarded (QSortFilterProxyModel already does the forwarding for you. Just disable the filtering by reimplementing acceptsRow/Column to always return true). //EDIT: Oh yes, and then use the proxy model between the model and the view with setSourceModel ;). If you want to tie the proxy model to the view, you can of course integrate the proxy model into the view and reimplement the setModel method of your view to call setSourceModel on the internal proxy, and then call the base class setModel function with the proxy as parameter.
  • Metro Ui using c++

    3
    0 Votes
    3 Posts
    4k Views
    L
    There is a public Nokia project about "Qt on Metro UI":http://projects.developer.nokia.com/qt_metro
  • How to use QTreeView::setRowHidden

    3
    0 Votes
    3 Posts
    4k Views
    O
    Han ok thanks, i try !