SVN commit 1197009 by sitter:
multiple qtoolbuttons in horizontal alignment == qtoolbar
M +16 -11 PrintKCM.cpp
M +4 -0 PrintKCM.h
M +27 -59 PrintKCM.ui
--- trunk/playground/base/print-manager/printer-manager-kcm/PrintKCM.cpp #1197008:1197009
@@ -59,10 +59,15 @@
setupUi(this);
- addPB->setIcon(KIcon("list-add"));
- removePB->setIcon(KIcon("list-remove"));
+ m_addAction = toolBar->addAction(KIcon("list-add"), "Add Printer",
+ this, SLOT(on_addPB_clicked()));
+ m_removeAction = toolBar->addAction(KIcon("list-remove"), "Remove Printer",
+ this, SLOT(on_removePB_clicked()));
+ toolBar->addSeparator();
+ m_configureAction = toolBar->addAction(KIcon("configure"), "Configure Printer",
+ this, SLOT(on_configurePrinterPB_clicked()));
+
preferencesPB->setIcon(KIcon("configure"));
- configurePrinterPB->setIcon(KIcon("configure"));
m_model = new PrinterModel(winId(), this);
printersTV->setModel(m_model);
@@ -136,15 +141,15 @@
// if no printer was found the server
// is still working
if (lastError == IPP_NOT_FOUND) {
- addPB->setEnabled(true);
+ m_addAction->setEnabled(true);
preferencesPB->setEnabled(true);
} else {
- addPB->setEnabled(!lastError);
+ m_addAction->setEnabled(!lastError);
preferencesPB->setEnabled(!lastError);
}
- removePB->setEnabled(false);
- configurePrinterPB->setEnabled(false);
+ m_removeAction->setEnabled(false);
+ m_configureAction->setEnabled(false);
printersTV->setEnabled(!lastError);
m_lastError = lastError;
// Force an update
@@ -179,8 +184,8 @@
int type = index.data(PrinterModel::DestType).toInt();
// If we remove discovered printers, they will come
// back to hunt us a bit later
- removePB->setEnabled(!(type & CUPS_PRINTER_DISCOVERED));
- configurePrinterPB->setEnabled(true);
+ m_removeAction->setEnabled(!(type & CUPS_PRINTER_DISCOVERED));
+ m_configureAction->setEnabled(true);
}
m_printerDesc->setDestName(index.data(PrinterModel::DestName).toString(),
index.data(PrinterModel::DestDescription).toString(),
@@ -201,8 +206,8 @@
// the model is empty and no problem happened
m_stackedLayout->setCurrentWidget(m_noPrinter);
// disable the printer action buttons if there is nothing to selected
- removePB->setEnabled(false);
- configurePrinterPB->setEnabled(false);
+ m_removeAction->setEnabled(false);
+ m_configureAction->setEnabled(false);
}
}
--- trunk/playground/base/print-manager/printer-manager-kcm/PrintKCM.h #1197008:1197009
@@ -54,6 +54,10 @@
QWidget *m_serverError;
KTitleWidget *m_serverErrorW;
int m_lastError;
+
+ QAction *m_addAction;
+ QAction *m_removeAction;
+ QAction *m_configureAction;
};
#endif
--- trunk/playground/base/print-manager/printer-manager-kcm/PrintKCM.ui #1197008:1197009
@@ -11,7 +11,7 @@
- -
+
-
false
@@ -39,7 +39,7 @@
- -
+
-
QFrame::NoFrame
@@ -59,79 +59,40 @@
- -
-
-
- false
+
-
+
+
+ Qt::Horizontal
-
- Add
-
-
- Add
-
-
- true
-
- -
-
-
- false
-
-
- Remove
-
-
- Remove
-
-
- true
-
-
-
-
-
+
- Qt::Vertical
+ Qt::Horizontal
-
-
- -
-
-
- false
+
+
+ 180
+ 20
+
-
- Configure
-
-
- Configure
-
-
- true
-
-
+
- -
-
-
- Qt::Horizontal
-
-
-
- -
+
-
false
- System Preferences
+ System Preferences
- -
+
-
+
+
+ -
Qt::Horizontal
@@ -149,6 +110,13 @@
+
+
+ KToolBar
+ QToolBar
+
+
+