Changeset 5193 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Oct 9, 2007 11:00:07 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 25120
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h
r5160 r5193 41 41 class QAction; 42 42 class QLabel; 43 class QToolButton; 43 44 44 45 // Auxiliary types … … 431 432 const char *aDisabled = 0, const char *aSmallDisabled = 0, 432 433 const char *aActive = 0, const char *aSmallActive = 0); 434 435 static void setTextLabel (QToolButton *aToolButton, const QString &aTextLabel); 433 436 434 437 static QRect normalizeGeometry (const QRect &aRect, const QRect &aBoundRect, -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r5160 r5193 37 37 #include <qimage.h> 38 38 #include <qlabel.h> 39 #include <qtoolbutton.h> 39 40 40 41 #ifdef Q_WS_X11 … … 2404 2405 } 2405 2406 2407 /** 2408 * Replacement for QToolButton::setTextLabel() that handles the shortcut 2409 * letter (if it is present in the argument string) as if it were a setText() 2410 * call: the shortcut letter is used to automatically assign an "Alt+<letter>" 2411 * accelerator key sequence to the given tool button. 2412 * 2413 * @note This method preserves the icon set if it was assigned before. Only 2414 * the text label and the accelerator are changed. 2415 * 2416 * @param aToolButton Tool button to set the text label on. 2417 * @param aTextLabel Text label to set. 2418 */ 2419 /* static */ 2420 void VBoxGlobal::setTextLabel (QToolButton *aToolButton, 2421 const QString &aTextLabel) 2422 { 2423 AssertReturnVoid (aToolButton != NULL); 2424 2425 /* remember the icon set as setText() will kill it */ 2426 QIconSet iset = aToolButton->iconSet(); 2427 /* re-use the setText() method to detect and set the accelerator */ 2428 aToolButton->setText (aTextLabel); 2429 QKeySequence accel = aToolButton->accel(); 2430 aToolButton->setTextLabel (aTextLabel); 2431 aToolButton->setIconSet (iset); 2432 /* set the accel last as setIconSet() would kill it */ 2433 aToolButton->setAccel (accel); 2434 } 2435 2406 2436 /** 2407 2437 * Ensures that the given rectangle \a aRect is fully contained within the
Note:
See TracChangeset
for help on using the changeset viewer.