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. Doing a mockup of a physical panel

Doing a mockup of a physical panel

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 543 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.
  • E Offline
    E Offline
    etla
    wrote on last edited by
    #1

    I'm in a new project that hasn't gotten so far that there's any kind of hardware done yet, but to get a feel of the UX I'm trying to do a mockup of the control panel. The controls will be physical buttons around a display (without touch) that reports back the system status, and I've built my UI on the image of the panel from the UX-designer and made certain areas clickable and so on. Works like a charm.

    What DOESN'T work like a charm is the display. Right now I'm simply drawing icons etc over the scanned image and while this works it means that I can't really simulate the final result but has to cludge around to get things drawn with an offset. What I would like to have would be a QWidget or similar that simply "floated" on top of the picture of the physical panel with the correct offset, something like this:

    0_1551192875070_6e15b187-dd67-4ab4-89b4-651b59df9f1f-image.png

    This so I can develop code that is as close as possible to the end result while the HW-guys are creating the actual hardware.

    Best would be if QWidget was transparent, but I'll settle with a square box on top of the panel too. After all it's just a mockup and we'll just have to live with the rounded corners not being rounded.

    Is this possible to do? How?

    Code in haste; debug in leisure.

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

      Hi
      Do mean if its possible to overlay widgets over some image ?
      Like
      alt text

      If yes, you can just display the image in a QLabel and then place a widget over that.

      E 1 Reply Last reply
      5
      • mrjjM mrjj

        Hi
        Do mean if its possible to overlay widgets over some image ?
        Like
        alt text

        If yes, you can just display the image in a QLabel and then place a widget over that.

        E Offline
        E Offline
        etla
        wrote on last edited by
        #3

        @mrjj Doh. Sometimes things are easier than you think and you're just thick! Thank you, worked like a charm.

        Code included in case someone else has the same problem in the future and is searching for an answer (replace QTextEdit with the widget of your preference):

        class TestWindow : public QMainWindow
        {
          public:
            TestWindow(QWidget *parent = nullptr) : QMainWindow(parent)
            {
                display = new QTextEdit(this);
                display->setText("Testing");
                display->resize(800, 480);
                display->move(955, 97);
            }
        
            virtual void paintEvent(QPaintEvent *)
            {
                QPainter painter(this);
                painter.drawImage(0, 0, QImage(":/mockup/panels/Panel.png"));
            }
        
          private:
            QTextEdit *display;
        };
        
        int main(int argc, char *argv[])
        {
            QApplication app(argc, argv);
        
            TestWindow testWindow;
            testWindow.show();
        
            return app.exec();
        }
        
        

        Code in haste; debug in leisure.

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved