Skip to content
  • 0 Votes
    3 Posts
    2k Views
    A
    Thank you for the answer. Setting a child did enable the layout selection. I don't understand the logic behind that at all but ok. QcmEntryGuess are QWidget I've created on the side. They're only a QLabel nested in two layout [image: 2e20a2c9-89a4-47e1-a1d3-6234e04464a2.png] Althought my QGridLayout is still only consisted of one row. I'm probably missunderstanding one of its property [image: 01294749-1d2a-4443-8237-3744be177d6c.png]
  • QVariantMap as model for Repeater

    Solved QML and Qt Quick repeater qvariantmap layout
    5
    0 Votes
    5 Posts
    2k Views
    raven-worxR
    @Kyeiv https://doc.qt.io/qt-5/qtquick-modelviewsdata-modelview.html#models those are your possibilities
  • Implement custom QML FlowLayout

    Unsolved QML and Qt Quick flow layout qml quick flowlayout
    1
    0 Votes
    1 Posts
    576 Views
    No one has replied
  • 0 Votes
    1 Posts
    565 Views
    No one has replied
  • TableView with exapanding columns

    Solved QML and Qt Quick qml tableview layout
    5
    0 Votes
    5 Posts
    1k Views
    nooneN
    adding onWidthChanged: forceLayout() with columnWidthProvider to TableView works
  • 0 Votes
    3 Posts
    2k Views
    GrecKoG
    @jeanmilost said in ListView - How to refresh rows which content changed without slowdown?: view.model.dataChanged(view.model.index(0, columnCount - 1), view.model.index(rowCount - 1, columnCount - 1)); So you are emiting dataChanged from QML? That seems like a bad practice, why can't you do that in the model?
  • Strange QMainWindow Layout behaviour

    Solved General and Desktop layout qmainwindow size
    12
    0 Votes
    12 Posts
    3k Views
    SGaistS
    Glad you found out and thanks for the detailed solution !
  • RowLaoyut reload/refresh after dynamic anchoring

    Unsolved QML and Qt Quick layout anchoring dynamic
    1
    0 Votes
    1 Posts
    341 Views
    No one has replied
  • 0 Votes
    3 Posts
    750 Views
    SGaistS
    Hi, To add a layout to a layout there's the "addLayout" method.
  • 0 Votes
    5 Posts
    868 Views
    _
    Indeed it is! :( It is something that we are looking into doing for certain this FY.
  • QSplitter child widget sizes affect eachother

    Unsolved General and Desktop splitter layout
    3
    0 Votes
    3 Posts
    674 Views
    K
    PyQt5 5.13.0, installed using pip.
  • 0 Votes
    2 Posts
    707 Views
    SGaistS
    Hi, From the looks of it, you will likely have to implement your own layout.
  • 0 Votes
    4 Posts
    2k Views
    A
    @J.Hilk Thanks for your test, I checked it and the setValue function is normally called with the right value and the display still doesn't display the change.
  • Set (individual) size for widgets in gridlayout

    Unsolved General and Desktop layout qgridlayout size
    2
    0 Votes
    2 Posts
    5k Views
    P
    @Agricola Hi. If you look for ideal elements fit, like in form in QTCreator, You don't have to use Layout. Just put widgets on place, make it ALL proportional etc. include class I put below, I put example too at the end It works like a charm, if you will have to use QLayouts, make them MaxMin constraint, but results may be strange. When you use it, better forget about layouts ;) #ifndef GEOFIT_H #define GEOFIT_H #include <QWidget> #include <QApplication> #include <QWidgetList> #include <QScreen> #include <QDebug> class geofit : public QObject { Q_OBJECT public: explicit geofit(QObject* parent=0); virtual ~geofit(); QString orientation(); QWidget* widget; void widgetsResizer(QWidget*); bool fixed; QScreen* primary_screen=QApplication::primaryScreen(); #if defined(Q_OS_IOS) QSize viewport_size=QApplication::primaryScreen()->availableVirtualSize(); #else QSize viewport_size=QApplication::primaryScreen()->availableVirtualSize(); #endif int sW=viewport_size.width(); int sH=viewport_size.height(); }; #endif // GEOFIT_H SOURCE: #include "geofit.h" geofit::geofit(QObject* parent){ fixed=true; // if you want to have MinMax sizes setted } geofit::~geofit() { } QString geofit::orientation() { Qt::ScreenOrientation orientation=QApplication::primaryScreen()->orientation(); switch (orientation) { case Qt::PrimaryOrientation : return "Primary"; case Qt::LandscapeOrientation : return "Landscape"; case Qt::PortraitOrientation : return "Portrait"; case Qt::InvertedLandscapeOrientation : return "Inverted landscape"; case Qt::InvertedPortraitOrientation : return "Inverted portrait"; default: return "Unknown"; } } // INTELLIGENT RESIZE FORM TO FIT WITH KEEPING ASPECT RATIO void geofit::widgetsResizer(QWidget* w){ int x,y,xs,ys; w->geometry().getCoords(&x,&y,&xs,&ys); qDebug()<<viewport_size; qreal sFY=qreal(sH) / qreal(ys-y); qreal sFX=qreal(sW) / qreal(xs-x); QList<QWidget *> widgets = w->findChildren<QWidget *>(); for(int j = 0; j < widgets.count(); ++j){ widget=widgets.at(j); if(widget!=nullptr){ if(widget->objectName()=="centralwidget"){ widget->setFixedSize(sW,sH); widget->resize(sW,sH); // qDebug()<<"centr:"<<sW<<sH<<widget->geometry()<<widget->geometry()<<w->sizeHint(); // w->adjustSize(); // uncomment if document is partially displayed continue; } // DO NOT CHANGE ANYTHING IN NEXT 4 LINES x=widget->x()*(sFX*10000)/10000; // left - top corner X y=widget->y()*(sFY*10000)/10000; // Y xs=widget->width()*(sFX*10000)/10000; // width ys=widget->height()*(sFY*10000)/10000; // qDebug()<<widget->objectName()<<"!!"<<widget->geometry()<<x<<y<<xs<<ys;// height if(fixed){ widget->setFixedSize(xs,ys); } else qInfo()<<widget->objectName()<<" :: NO FIXED POLICY"; widget->setGeometry(x,y,xs,ys); } } // qDebug()<<"W1:"<<w->geometry()<<","<<w->sizeHint(); w->adjustSize(); // qDebug()<<"W2:"<<w->geometry()<<","<<w->sizeHint(); fixed=true; } EXAMPLE 1: .... ui->setupUi(this); geofit geo; geo.widgetsResizer(this); showFullScreen(); .... you can use it external. too: geofit geo; a=new a(this) b=new b(this) c=new c(this) geo(a); geo(b); geo(c); Good luck :)
  • Strange behavior of widgets in QVBoxLayout

    Unsolved General and Desktop position layout qspacer
    10
    0 Votes
    10 Posts
    3k Views
    MasterBLBM
    It is as follows: Pic 3 with these long spacers contains complex widgets MechPartWidget presented in pic 4. You can see a tiny selection above the 2nd vertical spacer Then, in MechPartWidget there are no layouts/widgets with vertical horizontal policy set to expanding. Next, in the MechPartWidget there is a custom widget InventoryWidget. I tried to add QVBoxLayout to it, several widgets, and then a vertical spacer - and I expect this own-added layout would be honoured only inside boundaries of InventoryWidget, yet it isn't.
  • Add widget to layout programmatically

    Unsolved General and Desktop layout qwidget
    10
    0 Votes
    10 Posts
    9k Views
    J.HilkJ
    @kweber said in Add widget to layout programmatically: setLayout(ui->verticalLayout); my bad for posting untested code ui->centralWidget->setLayout(ui->verticalLayout);
  • 0 Votes
    2 Posts
    976 Views
    D
    After looking through implementation of Qt positioners (qquickpositioners.* in qtdeclarative) I have found that the positioning itself is done in updatePolish method while in itemChange and onCompleted methods positioning is schedule and polish is called. At this point I don't completely understand how it works, but it resolved my problem and I didn't have to resort to using qt private modules.
  • 0 Votes
    3 Posts
    1k Views
    mrjjM
    Hi I do most layouts using Designer and loads mostly data from code. But you dont have to choose one way over the other. The UI forms is converted to code ( see setupUI() ) so sometimes i use Designer to create a layout/setup and then use the code from my code as templates. The main reason we like using UI files is that it allows the non UX developers to do a bit of GUI sometimes as its less involving to drag a new button to a layout than reading heaps of setup code to find right spot. But basically, its more a matter of taste than anything technical . But there are things you need to do from code as designer cannot do it.
  • 0 Votes
    2 Posts
    2k Views
    SGaistS
    Hi and welcome to devnet, Did you put your widgets in layouts ? You might also be interested by QGraphicsView::fitInView.
  • 0 Votes
    2 Posts
    1k Views
    VRoninV
    @gizalp said in When resizes the entire window, the vertical layout (and thus its content) will stretch to fit it: How can I enable these options? click on the background. You probably also want to use "lay out in a grid" instead