Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • [Solved] Qt Creator 2.2.1 on Ubuntu 11.04: the GUI is messed up

    12
    0 Votes
    12 Posts
    5k Views
    EddyE
    You're welcome. I typed one "k" to much. but it all stays in the same family ;)
  • Any example of QInputMethodEvent usage?

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Build error: where to get info?

    6
    0 Votes
    6 Posts
    3k Views
    Z
    If you declare a function in header & not implemented in source file, that can produce such similar error. you can check the "Compile Output" Tab to see what is needed...
  • Set color of QWidget

    4
    0 Votes
    4 Posts
    23k Views
    L
    You are welcome! Sorry again for my first proposition - I rushed to answer without having read the question carefully :)
  • 0 Votes
    7 Posts
    4k Views
    G
    But that's only needed on windows for MSVC compiler, mingw does it in another way, so I suggest using Q_DECL_EXPORT / Q_DECL_IMPORT. They map to the correct, compiler specific code.
  • [SOLVED] Passing an integer value in QProcess

    5
    0 Votes
    5 Posts
    3k Views
    L
    as Tobias said, use "QString::number":http://doc.qt.nokia.com/4.7/qstring.html#number
  • Where to setup QT creator to locate all Qt include files?

    7
    0 Votes
    7 Posts
    11k Views
    EddyE
    @loladiro Just once ;) Man you're fast!
  • Qt locking QMainWindow when a QDialog is open

    2
    0 Votes
    2 Posts
    4k Views
    F
    Use QWidget::open() for window modal behavior.
  • 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
    1k 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
    22k 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
    15k 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