QScrollArea problem positioning a QWidget inside
i'm trying to move a QWidget which is inside of a QScrollArea but neither setGeometry() nor move() do work. here's a small example. what am i doing wrong here? qw always stays on the top left and doesn't move :(
Code:
#include <QApplication>
#include <QMainWindow>
#include <QScrollArea>
int main( int argc, char **argv )
{
qw->resize(100,100);
qw->move(80,80);
//qw->setGeometry(80,80,100,100);
sa->setWidget(qw);
mw->setCentralWidget( sa );
mw->show();
return a.exec();
}
Re: QScrollArea problem positioning a QWidget inside
Quote:
Originally Posted by Spectator
i'm trying to move a QWidget which is inside of a QScrollArea but neither setGeometry() nor move() do work. here's a small example. what am i doing wrong here? qw always stays on the top left and doesn't move :(
try to use method setFixedSize()
Re: QScrollArea problem positioning a QWidget inside
in which way would that help me? (have no qt environment here at the moment to test it)
i can set the widget's size without problems, but i can't chose where to position it inside of the scrollarea.
resize(100,100) works and makes the widget 100x100. the size part of setGeomety(int x, int y, int w, int h) also works but the positioning part not, same with move, no movement.
Re: QScrollArea problem positioning a QWidget inside
anyone?
I used a workaround now but i'm still confused why there's no way to move the QWidget inside the QScrollArea.
Workaround: used a QHBoxLayout together with some QSpacerItems to center the QWidget horizontally on the screen. But as I said above, i'm still confused.
Re: QScrollArea problem positioning a QWidget inside
Quote:
Originally Posted by Mad Max
try to use method setFixedSize()
Try moving the widget after you call setWidget().