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. [Solved]tab size
Forum Updated to NodeBB v4.3 + New Features

[Solved]tab size

Scheduled Pinned Locked Moved Mobile and Embedded
13 Posts 2 Posters 8.4k 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.
  • EddyE Offline
    EddyE Offline
    Eddy
    wrote on last edited by
    #2

    I think "this snippet":http://developer.qt.nokia.com/wiki/CustomTabBar is usefull for you.

    Qt Certified Specialist
    www.edalsolutions.be

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alfah
      wrote on last edited by
      #3

      Thanks eddy,

      i have managed to use the tabs. i have put a tab widget named tabWidget with 3 tabs to an already existing form using the designer

      The problem is, the calender is displayed in all the three tabs. i jus want it to be there while clicking any one of the tabs
      Or do i have to create a tabwidget manually than using the designer?????????????
      this is how i have created the calender buttons
      @
      for(int i=0;i<6;i++)
      {
      for(int j=0;j<7;j++)
      {

             cellBut[i][j]=new QPushButton(this);
             connect(cellBut[i][j],SIGNAL(clicked()),this,SLOT(onClickAction()));
             cellBut[i][j]->setFlat(true);
      
          }
      }
      

      @

      regards,
      alfah

      1 Reply Last reply
      0
      • EddyE Offline
        EddyE Offline
        Eddy
        wrote on last edited by
        #4

        You can use Qt Designer to add a tabwidget, drag a QCalendar to the first, drag something else to the second and so on.
        You can insert additional pages using RMB > Insert Page.

        Can you show your code where you add the Calendar to the TabWidget?

        Qt Certified Specialist
        www.edalsolutions.be

        1 Reply Last reply
        0
        • A Offline
          A Offline
          alfah
          wrote on last edited by
          #5

          eddy,

          I have already made a calender, in the sense, somthing like a custom calender.
          and the tabwidget is jus the default designer one.
          I cant figure out how to put the buttons/calender as whole on to the tab :(

          I have used
          @
          ui->setupUi(this);

          initMemberVariable();// here buttons are created- 30/31 days
          
          initMonthYear();// defining each month
          
          initWeekDay();// arranging the week display
          
          createLayout();// arranging the whole layout
          

          @

          alfah

          1 Reply Last reply
          0
          • EddyE Offline
            EddyE Offline
            Eddy
            wrote on last edited by
            #6

            I would expect you make a class for your custom widget and then you add an instance to a specific tab widget page.
            As I see your code, I guess you don't have a class?

            Qt Certified Specialist
            www.edalsolutions.be

            1 Reply Last reply
            0
            • A Offline
              A Offline
              alfah
              wrote on last edited by
              #7

              @
              CalenderForm::CalenderForm(QWidget *parent): QMainWindow(parent), ui(new Ui::CalenderForm)
              {
              ui->setupUi(this);

              initMemberVariable();
              
              initMonthYear();
              
              initWeekDay();
              
              createLayout();
              

              }
              @

              this class has few other functions defined too.
              could u elaborate on ur earlier explanation, i could not follow :(

              alfah

              1 Reply Last reply
              0
              • EddyE Offline
                EddyE Offline
                Eddy
                wrote on last edited by
                #8

                You are inheriting from QMainWindow. I would rather use a QWidget. Can you show your header file?

                Qt Certified Specialist
                www.edalsolutions.be

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  alfah
                  wrote on last edited by
                  #9

                  @

                  ifndef CALENDERFORM_H
                  #define CALENDERFORM_H

                  #include <QtGui/QMainWindow>
                  #include <QWidget>
                  #include <QDate>
                  #include <QtGui>
                  namespace Ui
                  {
                  class CalenderForm;
                  }

                  class CalenderForm : public QMainWindow
                  {
                  Q_OBJECT

                  public:
                  
                  explicit CalenderForm(QWidget *parent = 0);
                  virtual ~CalenderForm();
                  
                  private:
                  
                  Ui::CalenderForm *ui;
                  int monthValue;
                  
                  int iArrCycleStage[6][7];
                  int iArrDates[6][7],ht,wd;
                  QString strArrayNotes[6][7];
                  QDate selectedDate;
                  QGridLayout *controlsLayout;
                  QLabel *monthDisplay,*yearDisplay,*weekDisplay[7];
                  QHBoxLayout *weekLayout;
                  QPushButton *cellBut[6][7],*button;
                  QLabel *pLabelDateDisplay,*pLabelStatus;
                  QString strPreviousSelection;
                  

                  private slots:
                  }
                  @

                  alfah

                  1 Reply Last reply
                  0
                  • EddyE Offline
                    EddyE Offline
                    Eddy
                    wrote on last edited by
                    #10

                    As I said I would subclass from QWidget.

                    In Qt Designer you can put a QWidget in the tab you like as a placeholder and then promote it to your CalenderForm. When compiling the QWidget will be considered as a CalenderForm and shown that way.

                    Here is a "similar topic":http://developer.qt.nokia.com/forums/viewthread/8334/#48778 on how to promote a QFrame to a custom widget. Use a QWidget instead and your CalenderForm.

                    Qt Certified Specialist
                    www.edalsolutions.be

                    1 Reply Last reply
                    0
                    • EddyE Offline
                      EddyE Offline
                      Eddy
                      wrote on last edited by
                      #11

                      have a look at "this example":http://doc.qt.nokia.com/4.7/dialogs-tabdialog.html . it uses a QTabWidget and a class derived from QWidget to populate it.

                      Qt Certified Specialist
                      www.edalsolutions.be

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        alfah
                        wrote on last edited by
                        #12

                        Hello everyone,

                        I have a doubt regarding the tab size. The 3 tabs that I've created does not entirely fill up the screen. How can i expand the tabs to fill the screen????

                        alfah

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          alfah
                          wrote on last edited by
                          #13

                          :) i found the way too. simple, set its stylesheet :)

                          @
                          tabWidget->setStyleSheet("QTabBar::tab{height:60px; width:160px}");
                          @

                          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