Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QFormlayout with three options on the same line
Forum Updated to NodeBB v4.3 + New Features

QFormlayout with three options on the same line

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 901 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.
  • Nafab213N Offline
    Nafab213N Offline
    Nafab213
    wrote on last edited by
    #1

    For my program I inserted a Qformlayout but I would like the three options () to be on the same line. Like this
    Votre Classe : listedesclasses Série: listedesclasses, N°: listedesclasses
    How can I do ?
    Here's the code

     QFormLayout *cridebase = new QFormLayout;
        cridebase->addRow("Votre Matière", listedesmatiere);
        cridebase->addRow("Son Coeficient", coeficient);
        cridebase->addRow("Classe", listedesclasses); //1
        cridebase->addRow("Série", listedesseries); // 2
        cridebase->addRow("N° Classe", numerodeclasse); // 3    (1 + 2 + 3 on same line)
    
        QGridLayout *critdbase = new QGridLayout; //Un grille layout pour disposer correctement les différent élements de la fenêtre
        critdbase->addWidget(bienvenue, 1, 0, 6, 6);  //(bouton3, 1, 0, 1, 2);
        critdbase->addLayout(cridebase, 7, 0, 6, 6);
        critdbase->addWidget(bttcreer, 8, 3);
        critdbase->addWidget(bttannuler, 8, 5);
    

    I left the QGridlayout because I looked for the solution with him but it did not work.
    I am beginner so be explicit.
    Thank you in advance...

    Pl45m4P jsulmJ 2 Replies Last reply
    0
    • Nafab213N Nafab213

      For my program I inserted a Qformlayout but I would like the three options () to be on the same line. Like this
      Votre Classe : listedesclasses Série: listedesclasses, N°: listedesclasses
      How can I do ?
      Here's the code

       QFormLayout *cridebase = new QFormLayout;
          cridebase->addRow("Votre Matière", listedesmatiere);
          cridebase->addRow("Son Coeficient", coeficient);
          cridebase->addRow("Classe", listedesclasses); //1
          cridebase->addRow("Série", listedesseries); // 2
          cridebase->addRow("N° Classe", numerodeclasse); // 3    (1 + 2 + 3 on same line)
      
          QGridLayout *critdbase = new QGridLayout; //Un grille layout pour disposer correctement les différent élements de la fenêtre
          critdbase->addWidget(bienvenue, 1, 0, 6, 6);  //(bouton3, 1, 0, 1, 2);
          critdbase->addLayout(cridebase, 7, 0, 6, 6);
          critdbase->addWidget(bttcreer, 8, 3);
          critdbase->addWidget(bttannuler, 8, 5);
      

      I left the QGridlayout because I looked for the solution with him but it did not work.
      I am beginner so be explicit.
      Thank you in advance...

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #2

      @Nafab213

      Im not 100% sure, but I think you can use only 2 widgets (i.e. one for a label and one for a LineEdit) per line in a formlayout?!

      You can use a GridLayout in this case or you combine multiple Horizontal- and Vertical-Layouts


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      0
      • Nafab213N Nafab213

        For my program I inserted a Qformlayout but I would like the three options () to be on the same line. Like this
        Votre Classe : listedesclasses Série: listedesclasses, N°: listedesclasses
        How can I do ?
        Here's the code

         QFormLayout *cridebase = new QFormLayout;
            cridebase->addRow("Votre Matière", listedesmatiere);
            cridebase->addRow("Son Coeficient", coeficient);
            cridebase->addRow("Classe", listedesclasses); //1
            cridebase->addRow("Série", listedesseries); // 2
            cridebase->addRow("N° Classe", numerodeclasse); // 3    (1 + 2 + 3 on same line)
        
            QGridLayout *critdbase = new QGridLayout; //Un grille layout pour disposer correctement les différent élements de la fenêtre
            critdbase->addWidget(bienvenue, 1, 0, 6, 6);  //(bouton3, 1, 0, 1, 2);
            critdbase->addLayout(cridebase, 7, 0, 6, 6);
            critdbase->addWidget(bttcreer, 8, 3);
            critdbase->addWidget(bttannuler, 8, 5);
        

        I left the QGridlayout because I looked for the solution with him but it did not work.
        I am beginner so be explicit.
        Thank you in advance...

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @Nafab213 Put these 3 widgets as children on a parent widget and put this parent widget to the form layout.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        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