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. Our Qt application looks bad on a Mac (but good on Windows and good on Linux).
Forum Updated to NodeBB v4.3 + New Features

Our Qt application looks bad on a Mac (but good on Windows and good on Linux).

Scheduled Pinned Locked Moved General and Desktop
9 Posts 4 Posters 6.2k 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.
  • S Offline
    S Offline
    st2000
    wrote on last edited by
    #1

    Hi...

    Not sure if this has been covered. I tried to search the forum but didn't get any hits (i.e.: "Mac graphics off").

    We have been developing a Qt application with (what else) a number of buttons on different screens. It looks good on different Windows and different Linux boxes.** But on a Mac all the button graphics touch or over lap. Further, the overall positioning of the buttons do not appear correct. I spent a lot of time putting together an abbreviated QWERTY keyboard right up to the edge of our allocated Qt window. But on a Mac the keys overlap and there is a large border (i.e. wasted space) between the keyboard and the edge of the window.

    Is this a bug in the Qt/Mac port, or is there something we missed defining which just happens to be ok on (both) a Windows and Linux box but not on a Mac?

    -thanks for any help.

    **(Windows XP, XP-Pro, Linux Ubuntu & Fedora 15)

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      Could you post some screenshots? That would help people understanding what the problem is...

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • S Offline
        S Offline
        st2000
        wrote on last edited by
        #3

        Let's give that a try, never done that before in this forum.

        ...hummm, looks like you need to find 3rd party (web hosting site) for pictures. Bummer. Really, there is no way of directly using this sites features for posting small images?

        Well, just in words - the two images - it almost looks like the buttons on the Mac were drawn in together toward the center of the window. Think of it this way - say the center of each button were attached to stretched elastic sheet anchored at the center of the window. When the elastic sheet relaxes it draws the buttons together and towards the center of the window. This results in the buttons slightly overlapping and a larger unoccupied border between the edge of the window and the start of the button "cluster".

        -thanks

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dangelog
          wrote on last edited by
          #4

          You can just use any hoster like imageshack, tinypic, imgur, etc.

          Software Engineer
          KDAB (UK) Ltd., a KDAB Group company

          1 Reply Last reply
          0
          • S Offline
            S Offline
            st2000
            wrote on last edited by
            #5

            Hum, let's try it...
            http://imageshack.us/photo/my-images/571/macvswin.jpg/

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #6

              Just a question: Do you use a Qt layout to place the widgets?
              From the screenshots it seems that that UI is built using a layout with fixed coordinates or similar...

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • S Offline
                S Offline
                st2000
                wrote on last edited by
                #7

                This was all done in C++ code. We used a Qt grid to place these alpha/numeric gray buttons:
                @ QGridLayout *centerPageLayout;@
                @ centerPageLayout = new QGridLayout;
                centerPageLayout->setSpacing(4);@
                @ grid_row = 1;
                grid_column = 0;

                for(grid_button = 0; grid_button < max_list_buttons; ++grid_button)
                {
                    // Create a list of buttons
                    if(grid_button < 9)
                    {
                        // Put number on the buttons (1 through 9 & 0).
                        listButtons[grid_button] = new QPushButton(QString::number(grid_button+1));
                    }
                    else if(grid_button == 9)
                    {
                        listButtons[grid_button] = new QPushButton(QString::number(0));
                    }
                    else
                    {
                        // Put letters on buttons (A through Z).
                        listButtons[grid_button] = new QPushButton((QString)(grid_button - 10 + 'A'));
                    }
                
                    connect(listButtons[grid_button],SIGNAL(clicked()), this, SLOT(btnNumber()));
                
                    listButtons[grid_button]->setMinimumSize(QSize(grid_button_width, grid_button_height));
                    listButtons[grid_button]->setMaximumSize(QSize(grid_button_width, grid_button_height));
                    listButtons[grid_button]->setBaseSize(QSize(grid_button_width, grid_button_height));
                    font1.setPointSize(18);
                    listButtons[grid_button]->setFont(font1);
                    listButtons[grid_button]->setStyleSheet(QString::fromUtf8("QPushButton {border-image: url(:/CT_BTN_S_ACTIVE.png);\n"
                                                                              "color: white;\n"
                                                                              "border-radius: 5px;\n"
                                                                              "border-style: outset;}\n"
                                                                              "\n"
                                                                              "QPushButton:disabled {border-image: url(:/CT_BTN_S_INACTIVE.png);\n"
                                                                              "color: white;\n"
                                                                              "border-radius: 5px;\n"
                                                                              "border-style: outset;}\n"
                                                                              "\n"
                                                                              "QPushButton:pressed {border-image: url(:/CT_BTN_S_ACTIVE.png);\n"
                                                                              "color: rgb(0, 192, 0);\n"
                                                                              "border-radius: 5px;\n"
                                                                              "border-style: outset;}\n"
                                                                              ""));
                
                    // Add the list of buttons to the widget.
                    centerPageLayout->addWidget(listButtons[grid_button], grid_row, grid_column);
                    grid_column++;
                    if(grid_column >= list_buttons_per_row)
                    {
                        grid_column = 0;
                        grid_row++;
                        // Bump letter buttons over 2 spots on last line to make
                        // room for backspace button.
                        if(grid_row == 4)
                        {
                            grid_column = 2;
                        }
                    }
                }@
                
                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  PSI-lbc
                  wrote on last edited by
                  #8

                  Have you tried something like this...

                  @int main(int argc, char *argv[])
                  {
                  QApplication a(argc, argv);

                  // set the application look to be similar for Windows & Mac
                  
                  //a.setStyle(QStyleFactory::create( "cleanlooks" ));
                  //a.setStyle(QStyleFactory::create( "plastique" ));
                  //a.setStyle(QStyleFactory::create( "windows" ));
                  //a.setStyle(QStyleFactory::create( "windowsxp" ));
                  
                  a.setStyle(QStyleFactory::create( "windowsvista" ));
                  
                  MainWindow w;
                  w.show();
                  
                  return a.exec&#40;&#41;;@
                  

                  It will give the app the same general appearance, but possibly with color palette differences.

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    goetz
                    wrote on last edited by
                    #9

                    Problem is this code snippet:

                    @
                        listButtons[grid_button]->setMinimumSize(QSize(grid_button_width, grid_button_height));
                        listButtons[grid_button]->setMaximumSize(QSize(grid_button_width, grid_button_height));
                        listButtons[grid_button]->setBaseSize(QSize(grid_button_width, grid_button_height));
                    @

                    The sizes of buttons and the spacing of layouts differ from platform to platform. You do set a fixed size, which will clash with the platform defaults.

                    http://www.catb.org/~esr/faqs/smart-questions.html

                    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