Skip to content
QtWS25 Last Chance
  • QComboBox align text stylesheet?

    Unsolved General and Desktop qcombobox align text alignment stylesheet
    8
    0 Votes
    8 Posts
    12k Views
    S
    QComboBox {background-color:rgb(190,190,190);color:black;padding-left: 10px;padding-right: 30px;border-style: solid;border-width: 0px;} "padding-left: 10px;" the padding will shift the combo-box displayed content form the left edge QComboBox::drop-down {subcontrol-origin: padding; subcontrol-position: top right;width: 40px;border: 0px ;} "subcontrol-position: top right;" and the above will position wot text to the right. Hopefully this helps.
  • Troubleshoot with QTextEdit

    Unsolved General and Desktop qtextedit align troubleshoot qt designer
    7
    0 Votes
    7 Posts
    2k Views
    mrjjM
    @Matzomatzomatzo said: Hi if setAlignment sets the alignment for a paragraph of text (see doc) When you do ui->QtexteditObj->setText I think it replaces the paragraph with a new one since u replace all text and the default alignment is left for that new paragraph Just guessing. Did not test it :)
  • Qtableview aligment

    Solved General and Desktop qtableview align
    5
    0 Votes
    5 Posts
    4k Views
    PabloArgP
    Hi again Vronin; I improve little bit your idea. Perphaps is usefull for somebody. As I comment before, my tableview will have diferent types of Aligment. Some columns goes to right, other left, other center. But, I will use the same subclass created for QSqlQueryModel I will call this subclass many times in diferent part of my application. I created something more variable, so at the moment that you call the subclass you must define by QStringList define in my subclass, for each column what kind of aligment you like. Thanks Vronin for your help. And I share the code with you ================== MyQSqlQueryModel.h ====================== #ifndef MYQSQLQUERYMODEL_H #define MYQSQLQUERYMODEL_H #include <QSqlQueryModel> #include <QObject> class MyQSqlQueryModel : public QSqlQueryModel { public: MyQSqlQueryModel(); QVariant data(const QModelIndex &item, int role) const; QStringList AligmentDefinition; // HERE I DEFINE THE ALIGMENT BY COLUMNS }; #endif // MYQSQLQUERYMODEL_H ================== MyQSqlQueryModel.cpp ====================== #include "myqsqlquerymodel.h" MyQSqlQueryModel::MyQSqlQueryModel() { } QVariant MyQSqlQueryModel::data(const QModelIndex &item, int role) const { if(role==Qt::TextAlignmentRole) { if(AligmentDefinition.size()==0) {// There are any definition return 0; } if(item.column() > AligmentDefinition.size()) {// There are no definition for that Column return 0; } int i = item.column(); QString Value = AligmentDefinition.value(i); if(Value =="1") return int(Qt::AlignRight | Qt::AlignVCenter); if(Value=="2") return int(Qt::AlignCenter | Qt::AlignVCenter); if(Value=="3") return int(Qt::AlignLeft | Qt::AlignVCenter); } return QSqlQueryModel::data(item,role); } =============== MAIN PROGRAM ======================= MyQSqlQueryModel *model = new MyQSqlQueryModel; model->setQuery("SELECT * FROM SPSSourceLines"); model->AligmentDefinition << "1" << "2" << "3"; QModelIndex index; index = model->index(0,0); model->data(index,7);
  • Binding loop detected for width/height

    Unsolved QML and Qt Quick gridview binding loop align
    2
    0 Votes
    2 Posts
    2k Views
    p3c0P
    @Mark81 The cellHeight when changes updates the cellWidth in this line: cellWidth: Math.min(parent.width, parent.height) == parent.width ? parent.width / 3 : cellHeight this cellWidth change re-evaluates the binding and updates the cellHeight in this line: cellHeight: Math.min(parent.width, parent.height) == parent.width ? cellWidth : parent.height / 2 And this goes on foreever and hence the error. By the way, how to center the GridView content? It fills the available space from left-to right. How do you want it to appear ? Can you share some image ?
  • QTextTable reduce row height

    Solved General and Desktop qtexttable qtextbrowser align row
    9
    0 Votes
    9 Posts
    5k Views
    C
    @mrjj As you said this isn't beginner stuff, have tried but can't get it to work properly so I'll leave it for now and return to it after some while. Thank you so much, really appreciate all the help!
  • QComboBox with icons but no text - how?

    Solved General and Desktop qcombobox qicon align
    6
    0 Votes
    6 Posts
    6k Views
    Chris KawaC
    @wavelike said: don't they use QComboBox-like widgets to offer different colors, brush thickness etc? Hm, I guess that's true, but I'd say it has more to do with QMenus and QToolButtons than QComboBox. But then again they are indeed similar in some ways. Oh well, the important thing is it's doable and quite easy ;)
  • 0 Votes
    4 Posts
    4k Views
    F
    @Ratzz thank you !
  • Non-editable QComboBox text alignment

    General and Desktop qcombobox align
    2
    0 Votes
    2 Posts
    3k Views
    M
    HI and welcome to devnet, I think you should try to write your own QStyle
  • How to center GridView items

    QML and Qt Quick gridview center align qml
    10
    2 Votes
    10 Posts
    14k Views
    M
    @0sse Thanks, Your suggestion fix my problem.