Important: Please read the Qt Code of Conduct -

Setting up a QMenu

  • I've been looking around at a variety of QMenu creation tutorials one of which comes from the Qt team, it seems like there is a ton of overhead involved in doing this so my question is, is there an easier way of doing this?

    By easier I don't mean "Less complex" I just mean less code I fully understand what's occurring in the above link I just can't accept that it's the best way of setting up a menu as it seems very inefficient.

  • @Suroh6 Hi! You can do this without any code in Qt Designer.

  • Yeah, I understand that I just wasn't sure if there was a better way of implementing one without the use of the designer!

  • Hi @Suroh6 ,

    As @Wieland suggested , using UI is best option . you can have very very less code. you can add signals and other Qt things directly with out any code. you can also access all the objects of the UI again in the code. Like this.. UI *spinBox1->setRange(1,10) ;

    If you want to code only C++, then the option to reduce couple of lines code by coding with skill. But it reduces may be couple of lines that's it.

    Using UI, is always best option for the people who dont want to see more code and its highly user friendly.

  • @Ni.Sumi Yeah that's all I've managed to do myself is a handful of lines lol I guess I'll just stick with the Designer choice, thank you both for these responses!

Log in to reply