Hi guys, this is my first post here asking for help after I saw and realized that this gonna be one-stop answers & solutions for my Qt projects. would be highly grateful and thanks for your advice in advance !
This is what I am doing: mobile application using Qt and I use custom image background for main menu.
This is what I want:
********************************************
* Image Logo *
* Image Logo *
* Image Logo *
* Image Logo *
* *
* link 1 *
* link 2 *
* link 3 *
* link 4 *
********************************************
So, I coded like this:
Base class is MainWindow and link1-4 are custom subclass of QPushButton because I want to add stylesheet + addition features such as background images and sounds.Code:/******************* Custom Widget ********************/ QWidget *mainPage = new QWidget; setCentralWidget(mainPage); /******************* Layout ***************************/ QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(link1); layout->setAlignment(link1,Qt::AlignHCenter); layout->addWidget(link2); layout->setAlignment(link2,Qt::AlignHCenter); layout->addWidget(link3); layout->setAlignment(link3,Qt::AlignHCenter); layout->addWidget(link4); layout->setAlignment(link4,Qt::AlignHCenter); mainPage->setLayout(layout); /******************* MainWindow***************************/ setStyleSheet("QMainWindow { border-image: url(:/images/Default.png); }"); setWindowTitle(tr("Tangram Tangram Tangram"));
What actual outcome is that the layout overlaps the background image. I want to set the link buttons positions to lower: below the image logo and I tried setGeometry(Qrect) for both layout and links buttons, setSpacing() for the layout and nothing change.
********************************************
* Image Logo *
* link 1 logo *
* Image Logo *
* link 2 Logo *
* *
* link 3 *
* *
* link 4 *
* *
********************************************
When I googled for this problem, some people reimplement paintEvent(event) to position manually which obviously will be depending on the device you are targeting. For me, this is gonna be a tough task since I am quite new to Qt and Nokia Platforms.
Can you suggest me what should I use for this ? Is there a built-in ready baked codewhich can set the layout or buttons position ? Links for any sample programs would be greatly appreciate
Thanks in advance

which can set the layout or buttons position ? Links for any sample programs would be greatly appreciate
Reply With Quote


