UI: customizable toolbar



  • Is it possible to create with Qt5 customizable toolbars like in Microsoft Office, where you can drag toolbars, change their size and shape, add and remove buttons by dragging them in special 'customize' mode.

    To those, who didn't use MSOffice for a long time I should remind -- I'm asking about runtime phase, not the development phase. So please, don't suggest me to drag buttons in QT Designer...



  • I have not managed to implement the dragging of icons (inside the toolbar), but removing, inserting and of course moving the toolbar itself is possible and not too difficult to do. I posted about that one or two weeks ago, and I managed to get it working relatively fast.
    I don't think you can do it without coding some things, though.



  • Can your toolbar change size and shape? I.e. you drag the edge and it becomes narrower and taller and icons rearrange.

    The question is still open. Can icons be dragged inside toolbar and to and from?



  • What are you talking about? If you invest a little work, you can do all of these, except the "dragging inside". That's probably possible, too, somehow. I haven't invested too much time into getting it to work yet, though.

    If you drag the edge of the toolbar, it becomes smaller. If it becomes too small to show all its icons, an arrow is added at the end which makes the other icons available via a menu.
    You can move the toolbar around inside the window (for free, since that's standard behavior), position it at different places, put a couple of them together, etc.

    Adding/inserting buttons via drag&drop is no problem, for removing I chose to use a context menu.

    Maybe this answers your question: There is no drag&drop out-of-the-box, except for dragging the toolbar itself. Changing size is possible.

    If you need it to be more customizable, you could always subclass QWidget/QFrame or maybe even QMenu and do things yourself. Drag&Drop is pretty easy in Qt, once you understood the principle.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.