Skip to content
  • 0 Votes
    4 Posts
    1k Views
    N

    @mrjj I tried your code, here's the result:
    0_1549363016752_5cd8c55d-9905-4b92-bb0b-126715f37cae-image.png

  • 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 :)

  • 0 Votes
    4 Posts
    7k Views
    Y

    @SGaist

    Ahh thank you. Totally overlooked that while implementing.

  • 0 Votes
    2 Posts
    922 Views
    VRoninV

    f3 = new QFrame();

    ???

    How can I have a fixed size for the buttons for both the situations?

    c->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);

  • 0 Votes
    2 Posts
    833 Views
    jsulmJ

    @McLion You can use layouts for those labels

  • 0 Votes
    3 Posts
    9k Views
    pauleddP

    Thank you! I see you specified height and width manually. That works so far. I will use that.

  • 0 Votes
    7 Posts
    2k Views
    SGaistS

    What kind of text do you have that might be big enough to become a problem for your UI ?

  • 1 Votes
    9 Posts
    7k Views
    R

    @Schluchti I don't recall ever having an issue with the -Os flag in specific but then again it really depends on what you are doing and how you are coding it. :P

  • 0 Votes
    11 Posts
    7k Views
    T

    You could certainly make use of UPX, it should get the filesize down to maybe 4MB (by using compression).

  • QImage size after save

    Unsolved General and Desktop
    2
    0 Votes
    2 Posts
    1k Views
    raven-worxR

    @sabativi
    unless it's not a bug in the image writer plugin on OS X i would suspect that your QImage/QPixmap is already invalid.

    Please show the code where you create and paint into the image.

  • 0 Votes
    2 Posts
    903 Views
    SGaistS

    Hi,

    One way to do it would be to set the minimal size of your central widget or the maximal width of the QDockWidget contained widget.

    Hope it helps.

  • 0 Votes
    8 Posts
    5k Views
    kshegunovK

    @Bart_Vandewoestyne said:

    we're storing our Qt build in our version management system

    This is a strange thing to do, since Qt guarantees binary compatibility between minor versions, but well, you're free to choose. Unfortunately, I don't see how you could decrease the size further, beside deleting the docs, as the libraries are in the /lib directory and they're the next biggest size. Maybe store only the libs that you're using, i.e. these that you're going to deploy. No point in keeping QtXml if you're not using it, right?

  • 1 Votes
    3 Posts
    3k Views
    M

    @SGaist
    The QSizePolicy is set to Expanding, because I want the table should take all the space by default. Anyway I tried to set it to Minimum but nothing changes. It seems something force the minimum size of the table, but I printed out the actual minimumSize value and is set to 0, even after adding the contents.

  • 0 Votes
    3 Posts
    2k Views
    G

    The thing is, that i need this dots to be separate items, since they are used as clickable buttons. I tried to inherit from QTreeView and override drawRow, but when i do that, i need to override visualRect, indexAt and some other methods too, and that's realy inconvenient. Is there another way to reach my goals with QTreeView , or do i need to inherit from QAbstractItemView, and implement this kind of TreeView myself?

  • 0 Votes
    3 Posts
    4k Views
    N

    My TreeView is floating and I want its maximun width to be synchronized with its column content.
    But I also want to let the possibility to the user to reduce this size manually.
    I'd do something like :
    treeView->setMaximumWidth( sum(columnContentWidth));

  • 0 Votes
    9 Posts
    3k Views
    SGaistS

    You can also take a look at qfeatures.txt to see everything you can disable to make Qt smaller.

  • 0 Votes
    2 Posts
    2k Views
    R

    @marlenet15 See the docs : http://doc.qt.io/qt-5/qabstractbutton.html#iconSize-prop

  • 0 Votes
    2 Posts
    2k Views
    SGaistS

    Hi,

    You can add a stretch before or after the button so it will be pushed against a border.

    For your second question, you can again use the stretch like described here

  • 0 Votes
    2 Posts
    2k Views
    mrjjM

    hi
    It seems like if QDialog has a layout, the Maxsize don't work.
    however setting this on the inner layout
    OptionDialog d;
    d.layout()->setSizeConstraint (QLayout::SetMaximumSize);
    d.exec();

    Made the dialog, only be the MaximumSize.MaxHeight set in designer.
    all other values at default.
    Not sure its your case too.

  • 0 Votes
    3 Posts
    2k Views
    K

    @maximo Depending on needs of your application you may create a customized build of QtWebKit without some features, which may substantially reduce binary size.