Our Qt application looks bad on a Mac (but good on Windows and good on Linux).
-
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)
-
Could you post some screenshots? That would help people understanding what the problem is...
-
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
-
You can just use any hoster like imageshack, tinypic, imgur, etc.
-
Hum, let's try it...
http://imageshack.us/photo/my-images/571/macvswin.jpg/ -
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... -
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; } } }@
-
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();@
It will give the app the same general appearance, but possibly with color palette differences.
-
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.