Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Orientation problem
Qt 6.11 is out! See what's new in the release blog

Orientation problem

Scheduled Pinned Locked Moved Mobile and Embedded
11 Posts 1 Posters 4.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    prajnaranjan.das
    wrote on last edited by
    #1

    According to the link ,I have done it vertically but I want to do the things horizontally as I have mentioned in the link but cant able to....Can somebody please help me....

    https://picasaweb.google.com/pradhikari88/NOKIA#

    Prajnaranjan Das

    e mail: prajnaranjan.das@gmail.com

    1 Reply Last reply
    0
    • ? This user is from outside of this forum
      ? This user is from outside of this forum
      Guest
      wrote on last edited by
      #2

      you could refer to this for similar discussion: "http://developer.qt.nokia.com/forums/viewthread/1398":http://developer.qt.nokia.com/forums/viewthread/1398

      1 Reply Last reply
      0
      • P Offline
        P Offline
        prajnaranjan.das
        wrote on last edited by
        #3

        Thanks for your reply but still I am not getting any solution for this.....Is this possible that I can do coding for both horizontal and vertical view and declare a function , that if the condition is horizontal then it'll show horizontal view and in other case will show vertical view ...Please don't mind but is this possible .....

        Prajnaranjan Das

        e mail: prajnaranjan.das@gmail.com

        1 Reply Last reply
        0
        • ? This user is from outside of this forum
          ? This user is from outside of this forum
          Guest
          wrote on last edited by
          #4

          you can have 2 ui files for lanscape/portrait and switch as reqd

          or you could change layouts on the fly to suit your requirement (presuming the other widgets dont change)

          1 Reply Last reply
          0
          • P Offline
            P Offline
            prajnaranjan.das
            wrote on last edited by
            #5

            I have done upto this and here how can I declare a function based on my screen size ....means if (screen size =someValue)
            stackedWidget->setCurrentIndex(0);

            can anybody please tell me how should I declare a function for this
            i'm getting my screen size like this...

            SIZE:: QSize(360, 640)
            SIZE:: QSize(640, 360)

            @

            #include <QtGui/QVBoxLayout>
            #include <QtGui/QPushButton>
            #include <QtGui>
            #include <QResizeEvent>

            #include "rotate.h"

            Rotate::Rotate(QWidget *parent) :
            QWidget(parent)

            {

            QWidget *vWidget = new QWidget;
            vWidget->setObjectName(QString::fromUtf8("vWidget"));
            
            QPushButton *video1 = new QPushButton("VIDEOS");
            video1->setObjectName(QString::fromUtf8("video1"));
            video1->setFixedHeight(80);
            
            QPushButton *photo1 = new QPushButton("PHOTOS");
            photo1->setObjectName(QString::fromUtf8("photo1"));
            photo1->setFixedHeight(80);
            
            QPushButton *radio1 = new QPushButton("RADIO");
            radio1->setObjectName(QString::fromUtf8("radio1"));
            radio1->setFixedHeight(80);
            
            QPushButton *news1 = new QPushButton("NEWS");
            news1->setObjectName(QString::fromUtf8("news"));
            news1->setFixedHeight(80);
            
            
            QVBoxLayout *buttonLayout1 = new QVBoxLayout(vWidget);
            buttonLayout1->setContentsMargins(0,150,0,3);
            buttonLayout1->setSpacing(3);
            buttonLayout1->addWidget(video1);
            buttonLayout1->addWidget(photo1);
            buttonLayout1->addWidget(radio1);
            buttonLayout1->addWidget(news1);
            vWidget->setLayout(buttonLayout1);
            
            
            /////////////////////////////////////////////////////////
            
            
            QWidget *hWidget = new QWidget;
            
            QLabel *label = new QLabel;
            
            QPushButton *video2 = new QPushButton("VIDEOS");
            video2->setObjectName(QString::fromUtf8("video2"));
            video2->setFixedHeight(60);
            
            QPushButton *photo2 = new QPushButton("PHOTOS");
            photo2->setObjectName(QString::fromUtf8("photo2"));
            photo2->setFixedHeight(60);
            
            QPushButton *radio2 = new QPushButton("RADIO");
            radio2->setObjectName(QString::fromUtf8("radio2"));
            radio2->setFixedHeight(60);
            
            QPushButton *news2 = new QPushButton("NEWS");
            news2->setObjectName(QString::fromUtf8("news2"));
            news2->setFixedHeight(60);
            
            QVBoxLayout *buttonLayout2 = new QVBoxLayout;
            buttonLayout2->addWidget(video2);
            buttonLayout2->addWidget(photo2);
            buttonLayout2->addWidget(radio2);
            buttonLayout2->addWidget(news2);
            
            QPushButton *home = new QPushButton("HOME");
            QPushButton *back = new QPushButton("BACK");
            
            QHBoxLayout *hLayout2 = new QHBoxLayout;
            hLayout2->addWidget(home);
            hLayout2->addWidget(back);
            
            QVBoxLayout *vLayout2 = new QVBoxLayout;
            vLayout2->addWidget(label);
            vLayout2->addLayout(hLayout2);
            
            
            QHBoxLayout *hLayout3 = new QHBoxLayout(hWidget);
            hLayout3->addLayout(vLayout2);
            hLayout3->addLayout(buttonLayout2);
            hWidget->setLayout(hLayout3);
            
            
            ///////////////////////////////////////////////////////////////
            
            
            QStackedWidget *stackedWidget = new QStackedWidget;
            stackedWidget->addWidget(vWidget);
            stackedWidget->addWidget(hWidget);
            
            QVBoxLayout *layout = new QVBoxLayout;
            layout->addWidget(stackedWidget);
            setLayout(layout);
            
            stackedWidget->setCurrentIndex(1);
            

            }

            void Rotate::resizeEvent(QResizeEvent *event)
            {
            qDebug()<<"SIZE::"<<qApp->desktop()->size();
            }
            @

            Prajnaranjan Das

            e mail: prajnaranjan.das@gmail.com

            1 Reply Last reply
            0
            • ? This user is from outside of this forum
              ? This user is from outside of this forum
              Guest
              wrote on last edited by
              #6

              instead of that, check if QOrientationReading can help you to get the device orientation, you should also be able to get screen size directly via API instead of hardcoding it.

              1 Reply Last reply
              0
              • P Offline
                P Offline
                prajnaranjan.das
                wrote on last edited by
                #7

                thanks chetankjain for your reply

                I did it in another way....Its working......

                @
                void Rotate::resizeEvent(QResizeEvent *event)
                {
                qDebug()<<"SIZE::"<<qApp->desktop()->size();
                if(qApp->desktop()->size()== QSize(360,640))
                {
                stackedWidget->setCurrentIndex(0);
                }
                else
                {
                stackedWidget->setCurrentIndex(1);
                }
                }
                @

                Prajnaranjan Das

                e mail: prajnaranjan.das@gmail.com

                1 Reply Last reply
                0
                • ? This user is from outside of this forum
                  ? This user is from outside of this forum
                  Guest
                  wrote on last edited by
                  #8

                  hi prajnaranjan, good to hear that. But what if your screen size is not 360x640 ?

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    prajnaranjan.das
                    wrote on last edited by
                    #9

                    You are correct but I cant find any other options....if you have any other way than this,please tell me ....

                    Prajnaranjan Das

                    e mail: prajnaranjan.das@gmail.com

                    1 Reply Last reply
                    0
                    • ? This user is from outside of this forum
                      ? This user is from outside of this forum
                      Guest
                      wrote on last edited by
                      #10

                      can you chk if QOrientationReading can help here?
                      "http://doc.troll.no/qtmobility-1.0/qorientationreading.html#orientation-prop":http://doc.troll.no/qtmobility-1.0/qorientationreading.html#orientation-prop

                      1 Reply Last reply
                      0
                      • P Offline
                        P Offline
                        prajnaranjan.das
                        wrote on last edited by
                        #11

                        This is surely helpful but in this case it is different...Thanks for your reply...

                        Prajnaranjan Das

                        e mail: prajnaranjan.das@gmail.com

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved