Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.5k Topics 457.3k Posts
  • Mysterious flickering arrow

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • Relation between QFonMetrics.width and QTextLayout.maximumWidth?

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • Detecting Qt libraries in the 'framework' format

    9
    0 Votes
    9 Posts
    4k Views
    D
    Okeh, thanks!
  • Unexpected QList behaviour with nested structures.

    Locked
    11
    0 Votes
    11 Posts
    5k Views
    G
    Gourmand: please be patient. All people here are here because they like Qt and in their free time. If you get rude, you will get no answers. So I suggest, you keep being patient. EDIT: closed the thread
  • 0 Votes
    3 Posts
    3k Views
    V
    Found easy solution by using signals and slots. This system rocks! @// Populate the group ComboBox groupModel = new QSqlRelationalTableModel(this, QSqlDatabase::database("******")); groupModel->setTable(""TB_Groupe""); groupModel->setSort(groupModel->fieldIndex("GR_Nom"), Qt::AscendingOrder); groupModel->select(); ui->MW_groupComboBox->setModel(groupModel); ui->MW_groupComboBox->setModelColumn(groupModel->fieldIndex("GR_Nom")); // Populate category ComboBox according to Group ComboBox catModel = new QSqlRelationalTableModel(this, QSqlDatabase::database("*******")); catModel->setTable("\"TB_Categorie\""); catModel->setFilter("\"CAT_IndexGroupe\" = " % QString::number(ui->MW_groupComboBox->currentIndex()+1)); catModel->setSort(catModel->fieldIndex("CAT_Nom"), Qt::AscendingOrder); catModel->select(); ui->MW_catComboBox->setModel(catModel); ui->MW_catComboBox->setModelColumn(catModel->fieldIndex("CAT_Nom")); connect(ui->MW_groupComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(RefreshCategory(int))); } void MainWindow::RefreshCategory(int choice) { catModel->setFilter(""CAT_IndexGroupe" = " % QString::number(choice+1)); catModel->select(); ui->MW_catComboBox->setModel(catModel); ui->MW_catComboBox->setModelColumn(catModel->fieldIndex("CAT_Nom")); }@
  • Special characters in XML files created with QDomDocument

    21
    0 Votes
    21 Posts
    23k Views
    G
    Here are the results of the checks with Microsoft's Office Excel: one has to rename the file from .xlsx to .xml to be able to import it using a literal newline character ('\n') in the strings does not work replacing the literal newline with '
' (aka entity) does work one must put a suitable cell format into the xml to enable line breaks So, the conclusion is, that the XML parser that is used by Excel to handle the file is definitely broken and does not follow the standards! You can easily test this by using xmllint: Save a file from excel in XML format, have xmllint parse it and save the result (this replaces all '
' with literal newlines) and try to open the file in Excel. It will fail. Unfortunately I see no chance in getting some easy support for this case into Qt. You would have to patch method "static QString encodeText()" in qdom.cpp to escape newlines.
  • 0 Votes
    4 Posts
    4k Views
    G
    well, I solved it by using the painter: @ void MyTypeDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { int value = index.model()->data(index, Qt::DisplayRole).toInt(); QString text; switch(value){ case MyTypes::Type_A: text = "type A"; break; //.... and so on }; QRect r = option.rect.adjusted(2, 2, -2, -2); painter->drawText(r.left(), r.top(), r.width(), r.height(), Qt::AlignVCenter|Qt::AlignLeft|Qt::TextWordWrap, text, &r); @ it is a quick and dirty solution but will do for the time table I have for this, a proxy model might be a better solution, but, the delegate also handles the editing part of the cell, so, it's a good 'all in one' solution
  • [SOLVED] how to parse character pointer;

    10
    0 Votes
    10 Posts
    3k Views
    T
    hello everyone i got success. thanks volker and andre , you really helped me.
  • [Solved] QGraphicsItems not painted if not completely visible

    22
    0 Votes
    22 Posts
    16k Views
    E
    I knew what you meant jim and now my problem seems to be fixed. I did the following: @node->setPos( (node->getXMax() - node->getXMin()) / 2.0 + node->getXMin(), (node->getYMax() - node->getYMin()) / 2.0 + node->getYMin() ); scene()->addItem( node );@ so the the item's center is half between xmin and xmax and half between ymin and ymax. The bounding rect is now implemented as follows: @QRectF MyGraphicsItem::boundingRect() const { QPointF pt1 = mapFromScene(QPointF(xmin,ymin)); QPointF pt2 = mapFromScene(QPointF(xmax,ymax)); return QRectF(pt1,pt2); }@ So the boundingRect() lies correctly around the center. The item's are now drawn correctly, even if only partly visible. Many thanks to everyone who helped me out of this! :)
  • Using an existing DLL/Lib with Qt

    13
    0 Votes
    13 Posts
    84k Views
    M
    Cheers Jim.
  • Dock a QDockWidget in a QToolbar

    2
    0 Votes
    2 Posts
    2k Views
    A
    I doubt it can be done, at least in a straightforward way.
  • [Solved] How to handle position changed of QWidget?

    3
    0 Votes
    3 Posts
    7k Views
    F
    Thanks, it worked
  • How to move the downloaded file to specified directory in Qt

    3
    0 Votes
    3 Posts
    4k Views
    X
    thank you for your advice,It works ! Thanks again!
  • Inserting row into QSqlQueryModel trough QDataWidgetMapper

    1
    0 Votes
    1 Posts
    3k Views
    No one has replied
  • How to kill a windows process if running from my Qt Application?

    5
    0 Votes
    5 Posts
    7k Views
    T
    You can use #ifdef Q_OS_WIN or something to mask out your windows code when not building on windows or put the OS specific code into separate files and have the build system sort out which object files to link together.
  • Unexpected behaviour in slot with Qt::DirectConnection

    31
    0 Votes
    31 Posts
    12k Views
    Z
    There is no automatic multi-threading mode for plugins and so it cannot be documented. What you are seeing is the direct and predictable result of the code you designed and implemented. Whether this was a conscious decision or an unexpected/unanticipated behaviour on your part does not matter. This is not a bug in Qt (either documentation or source). If you are still convinced that this is a bug in Qt then you will need to spend the time to make small compilable example that reproduces the issue. With this then we or the trolls can help you in fixing it or explaining the code paths that lead to the observed behaviour. Doing the above is often a valuable process anyway since by doing so you very often find the bug or the key to understanding the issue. Nobody is trying to accuse you of not understanding signals/slots/connections or multi-threading. Just that sometimes when used in conjunction these topics can lead to what seems like strange behaviour. I have been there myself many times ;-) Good luck with the rest of your project.
  • 0 Votes
    6 Posts
    6k Views
    P
    Thank you :) This code is working fine for me.
  • QTcpSocket with signal capability

    4
    0 Votes
    4 Posts
    3k Views
    A
    As a general rule: if you find that some method, signal, property... that you think should obviously be in a class isn't in the documentation for that class, you should either browse the documentation of the superclasses, or just click the "List of all members, including inherited members" link. There is a good chance you'll find what you are looking for in (abstract) base class.
  • MVC Architecture

    14
    0 Votes
    14 Posts
    9k Views
    M
    [quote author="iamcreasy" date="1308493651"]@sigrid "You might want to make this post sticky":http://developer.qt.nokia.com/forums/viewthread/6749/ There is no system of PM in this forum. I could send it you directly.[/quote] We seldom use stickies on this forum, mostly for procedural things or events while they happen. We don't have a PM system, but you can send e-mail to any member from their profile page.
  • Hiding rows in QTableView seems to be slow

    8
    0 Votes
    8 Posts
    10k Views
    S
    The procedure I described above works very well. Thanks a lot to Eddy and loladiro. Just one thing I would like to add is that instead of calling "invalidateFilter()" on the custom QSortFilterProxyModel, one should call "invalidate()" which is considerably faster. I don't know why... Steffen