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. Panels for toolbars?
Forum Updated to NodeBB v4.3 + New Features

Panels for toolbars?

Scheduled Pinned Locked Moved Solved General and Desktop
14 Posts 2 Posters 1.7k 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.
  • DriftwoodD Offline
    DriftwoodD Offline
    Driftwood
    wrote on last edited by
    #1

    Hi Forum.

    I tried Qt a while back, but ended up using Lazarus and Free Pascal. That said, my first question here is this:

    What design component do I use to build my toolbar on? In the other environment, I used panels extensively, and they were especially good for this. But I see no panels in the Qt toolset.

    Thanks in advance for your help.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi and welcome to the forums.
      What is does a panel do in the other frameworks ?
      The QToolbar accept widgets via
      https://doc.qt.io/qt-5/qtoolbar.html#addWidget
      so you can most insert components in QToolbar.
      and you can have multiple toolbars.
      void QMainWindow::insertToolBar(QToolBar *before, QToolBar *toolbar)
      Given sort of the features, we know from bands in other frameworks.
      However, its unclear what you need from it so its hard to say which way to go :)

      1 Reply Last reply
      0
      • DriftwoodD Offline
        DriftwoodD Offline
        Driftwood
        wrote on last edited by
        #3

        @mrjj - I can set a panel and align it to the top of the form, set it's height to, let's say 100, and add icons, combo boxes, radio buttons, etc to it. I found a widget component in the Qt toolset, so many that's what I need here. I'll just experiment around.

        Thank you for your response, mrjj. Much appreciated.

        mrjjM 1 Reply Last reply
        0
        • DriftwoodD Driftwood

          @mrjj - I can set a panel and align it to the top of the form, set it's height to, let's say 100, and add icons, combo boxes, radio buttons, etc to it. I found a widget component in the Qt toolset, so many that's what I need here. I'll just experiment around.

          Thank you for your response, mrjj. Much appreciated.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          @Driftwood
          Hi
          Most widgets can be a container so you can use any widget to hold other widgets.
          However, QFrame might be very suited for such panel.

          Please note that layouts are a bit different in Qt than in say VCL.
          You put widgets in layouts that control the placement and size.
          So if you look at the properties and wonder where the layout options is hidden, it's due to the fact that it works slightly differently.

          Also, just to be upfront. When you want to apply a layout to a widget,
          you then right click and select one from the layout menu.
          The red layouts shown in the widget list, is for inserting into other layouts but
          is not good as base layout as they dont snap to the container but float around.
          So right click:) for a base / top layout.

          1 Reply Last reply
          2
          • DriftwoodD Offline
            DriftwoodD Offline
            Driftwood
            wrote on last edited by Driftwood
            #5

            @mrjj
            Thanks for the heads up. The layouts will be different, for sure. Lazarus uses an excellent anchor system. In truth, it's the best I've ever seen for Form layouts. But I can adapt to Qt's system =)

            mrjjM 1 Reply Last reply
            0
            • DriftwoodD Driftwood

              @mrjj
              Thanks for the heads up. The layouts will be different, for sure. Lazarus uses an excellent anchor system. In truth, it's the best I've ever seen for Form layouts. But I can adapt to Qt's system =)

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by mrjj
              #6

              @Driftwood
              I used Delphi/c++ builder for many years and yes the anchor is excellent.
              That said, when you get to know the layout system, its also good to work with.
              Last note you should be aware f.
              When using designer, the UI files are used to generate c++ code.
              If you look in the setupUI function you can see it.
              That makes it possible to draw a complex layout and then steal the code to reuse
              runtime/non visually.
              So its not - use UI files or code. its quite possible to use both in a lovely mix.

              1 Reply Last reply
              3
              • DriftwoodD Offline
                DriftwoodD Offline
                Driftwood
                wrote on last edited by
                #7

                @mrjj
                Thanks for the tip. I only hope you're as good with databases, because that's why I program. In truth, I'm working on an extremely complex database program now that's grid intensive, grids that contain combo boxes and checkboxes and all the fun stuff =) I'm sure I'll have a slew of questions for the forum when I begin this project using Qt. I've noticed Qt isn't as database friendly as Delphi and Lazarus, so I'm sure this will be a challenge for me.

                Thanks again for the layout tip.

                mrjjM 1 Reply Last reply
                0
                • DriftwoodD Driftwood

                  @mrjj
                  Thanks for the tip. I only hope you're as good with databases, because that's why I program. In truth, I'm working on an extremely complex database program now that's grid intensive, grids that contain combo boxes and checkboxes and all the fun stuff =) I'm sure I'll have a slew of questions for the forum when I begin this project using Qt. I've noticed Qt isn't as database friendly as Delphi and Lazarus, so I'm sure this will be a challenge for me.

                  Thanks again for the layout tip.

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Driftwood
                  Oh. well Qt do not have database aware widgets in same manner as Delphi
                  but luckily Qt is very flexible and easy to extend.

                  The way to have combo/checkboxes and the like in the data grid is to use
                  delegates which basically just draw the button/checkbox/xx when not in edit mode.
                  This helps to have good performance when many rows.

                  https://doc.qt.io/qt-5/qtwidgets-itemviews-stardelegate-example.html

                  This example has a rating widget in the grid. Its excactly same way for any other
                  widget you want to include in a grids. (view)

                  So its a bit work up front but the reward is max speed later :)

                  1 Reply Last reply
                  1
                  • DriftwoodD Offline
                    DriftwoodD Offline
                    Driftwood
                    wrote on last edited by
                    #9

                    @mrjj
                    I may be switching over to Qt sooner than later. While I haven't done much with it, I know Qt is rock solid. And right now, I'm struggling with glitchy DBGrids. I'm fighting one right now that I have row selection turned off and it stays on. I just want to highlight one cell at a time, not twenty =)

                    Yes, I believe Qt's the ticket, my answer to peaceful sleep, the DBGrid nightmares forever banished! =)

                    Thanks for the link.

                    mrjjM 1 Reply Last reply
                    1
                    • DriftwoodD Driftwood

                      @mrjj
                      I may be switching over to Qt sooner than later. While I haven't done much with it, I know Qt is rock solid. And right now, I'm struggling with glitchy DBGrids. I'm fighting one right now that I have row selection turned off and it stays on. I just want to highlight one cell at a time, not twenty =)

                      Yes, I believe Qt's the ticket, my answer to peaceful sleep, the DBGrid nightmares forever banished! =)

                      Thanks for the link.

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @Driftwood
                      Hehe well after the initial work where you make your own DDGrid,
                      i think you be pretty happy.
                      Be aware that Qt uses models for most data viewing so for the first test, you should look at https://doc.qt.io/qt-5/sql-model.html
                      And for sorting and filtering, you use https://doc.qt.io/qt-5/qsortfilterproxymodel.html
                      While it taks a bit more initial setup, its also very powerfull and using a subclass you
                      can make it sort or filter in any way, you dream of, should the regular expressions not be
                      enough.

                      1 Reply Last reply
                      2
                      • DriftwoodD Offline
                        DriftwoodD Offline
                        Driftwood
                        wrote on last edited by
                        #11

                        @mrjj
                        WOW! That's awesome stuff! I wish I'd started using Qt a few years back; I'd be so far ahead of the curve by now. But there's no time like the present. You're a good salesman. Hahaha =)

                        mrjjM 1 Reply Last reply
                        0
                        • DriftwoodD Driftwood

                          @mrjj
                          WOW! That's awesome stuff! I wish I'd started using Qt a few years back; I'd be so far ahead of the curve by now. But there's no time like the present. You're a good salesman. Hahaha =)

                          mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          @Driftwood
                          Heheh good to hear.
                          That said, i still miss the WITH from Delphi/pascal in c++ :)

                          1 Reply Last reply
                          0
                          • DriftwoodD Offline
                            DriftwoodD Offline
                            Driftwood
                            wrote on last edited by
                            #13

                            I use with all the time. I'm sort of new to C++ and wasn't yet aware I cldn't do things like:

                            with DBComboBox_InventoryUnit do
                              begin
                                DataField := 'inventory_unit';
                                DataSource := DS_AddItems;
                                Visible:= False;
                              end; 
                            

                            But programming's programming. I'm sure it'll all bear the same fruit, just have to be gardened differently =)

                            mrjjM 1 Reply Last reply
                            0
                            • DriftwoodD Driftwood

                              I use with all the time. I'm sort of new to C++ and wasn't yet aware I cldn't do things like:

                              with DBComboBox_InventoryUnit do
                                begin
                                  DataField := 'inventory_unit';
                                  DataSource := DS_AddItems;
                                  Visible:= False;
                                end; 
                              

                              But programming's programming. I'm sure it'll all bear the same fruit, just have to be gardened differently =)

                              mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              @Driftwood
                              excactly :)
                              Nothing really comes close in c++ outside of ugly macro hax.

                              you can do

                              auto & inv = *DBComboBox_InventoryUnit;
                              inv.DataFIeld = ".."

                              but it really is not as elegant.

                              But on the bright side. c++ will offer many nice features not found in pascal if using
                              c++11 or more.

                              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