Changeset 1017 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Feb 21, 2007 10:08:04 PM (18 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/QIRichLabel.h
r382 r1017 78 78 79 79 void setFont( const QFont &f ); 80 void setFixedHeight (int); 80 81 81 82 public slots: … … 88 89 void clear(); 89 90 91 protected slots: 92 void putToClipBoard(); 93 90 94 protected: 91 95 void drawContents ( QPainter * ); … … 96 100 void contextMenuEvent (QContextMenuEvent*); 97 101 98 protected slots:99 void putToClipBoard();102 signals: 103 void textChanged(); 100 104 101 105 private slots: … … 116 120 QPicture *lpicture; 117 121 QMovie *lmovie; 118 QAction *copyAction;119 122 QPopupMenu *popupMenu; 120 123 QWidget *lbuddy; … … 123 126 uint autoresize:1; 124 127 uint scaledcontents :1; 128 uint baseheight; 125 129 TextFormat textformat; 126 130 QAccel *accel; -
trunk/src/VBox/Frontends/VirtualBox/src/QIRichLabel.cpp
r382 r1017 92 92 void QIRichLabel::init() 93 93 { 94 baseheight = 0; 94 95 lpixmap = 0; 95 96 lmovie = 0; … … 107 108 d = new QLabelPrivate; 108 109 109 copyAction = new QAction (this, "copyAction");110 QAction *copyAction = new QAction (this, "copyAction"); 110 111 connect (copyAction, SIGNAL (activated()), 111 112 this, SLOT (putToClipBoard())); … … 114 115 popupMenu = new QPopupMenu (this, "contextMenu"); 115 116 copyAction->addTo (popupMenu); 117 } 118 119 120 void QIRichLabel::setFixedHeight (int aHeight) 121 { 122 baseheight = aHeight; 123 QFrame::setFixedHeight (baseheight); 116 124 } 117 125 … … 156 164 } 157 165 158 // If there is QSimpleRichText:159 if (useRichText)160 setFocusPolicy (doc ? QWidget::StrongFocus : QWidget::NoFocus);161 162 166 updateLabel (osh); 167 168 if (baseheight == 0) 169 baseheight = heightForWidth (width()); 170 if ((int)baseheight < heightForWidth (width())) 171 QFrame::setFixedHeight (heightForWidth (width())); 172 else 173 QFrame::setFixedHeight (baseheight); 174 emit textChanged(); 163 175 } 164 176 … … 441 453 void QIRichLabel::contextMenuEvent (QContextMenuEvent *aEvent) 442 454 { 443 popupMenu->popup(aEvent->globalPos()); 455 if (hasFocus()) 456 popupMenu->popup(aEvent->globalPos()); 444 457 } 445 458 … … 548 561 QString filteredText = compressText(); 549 562 doc = new QSimpleRichText (filteredText, font()); 550 doc->setWidth (p, cr.width()); 563 /* focus indent */ 564 int xo = 3; 565 doc->setWidth (p, cr.width() - 2*xo); 551 566 int rh = doc->height(); 552 567 int yo = 0; 553 int xo = 3;554 568 if (align & AlignVCenter) 555 569 yo = (cr.height()-rh)/2; -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxDiskImageManagerDlg.ui.h
r1015 r1017 399 399 QIRichLabel *infoLabel = new QIRichLabel (root, "infoPane"); 400 400 401 /* Setup focus policy <strong> default for info pane */ 402 infoLabel->setFocusPolicy (QWidget::StrongFocus); 403 401 404 /* prevent the name columns from being expanded */ 402 405 nameLabel->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed); -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui
r924 r1017 2467 2467 </widget> 2468 2468 </hbox> 2469 </widget>2470 <widget class="QLabel" row="2" column="1">2471 <property name="name">2472 <cstring>whatsThisLabel</cstring>2473 </property>2474 <property name="sizePolicy">2475 <sizepolicy>2476 <hsizetype>7</hsizetype>2477 <vsizetype>0</vsizetype>2478 <horstretch>0</horstretch>2479 <verstretch>0</verstretch>2480 </sizepolicy>2481 </property>2482 <property name="minimumSize">2483 <size>2484 <width>0</width>2485 <height>0</height>2486 </size>2487 </property>2488 <property name="backgroundMode">2489 <enum>PaletteMidlight</enum>2490 </property>2491 <property name="paletteForegroundColor">2492 <color>2493 <red>75</red>2494 <green>75</green>2495 <blue>75</blue>2496 </color>2497 </property>2498 <property name="frameShape">2499 <enum>Box</enum>2500 </property>2501 <property name="frameShadow">2502 <enum>Sunken</enum>2503 </property>2504 <property name="margin">2505 <number>7</number>2506 </property>2507 <property name="scaledContents">2508 <bool>false</bool>2509 </property>2510 <property name="alignment">2511 <set>WordBreak|AlignJustify|AlignTop</set>2512 </property>2513 2469 </widget> 2514 2470 </grid> … … 2686 2642 <include location="local" impldecl="in implementation">VBoxDiskImageManagerDlg.h</include> 2687 2643 <include location="local" impldecl="in implementation">VBoxMediaComboBox.h</include> 2644 <include location="local" impldecl="in implementation">QIRichLabel.h</include> 2688 2645 </includes> 2689 2646 <forwards> … … 2692 2649 <forward>class VBoxUSBMenu</forward> 2693 2650 <forward>class VBoxSharedFoldersSettings</forward> 2651 <forward>class QIRichLabel</forward> 2694 2652 </forwards> 2695 2653 <variables> … … 2724 2682 <variable access="private">VBoxMediaComboBox *cbISOFloppy;</variable> 2725 2683 <variable access="private">VBoxUSBMenu *usbDevicesMenu;</variable> 2684 <variable access="private">QIRichLabel *whatsThisLabel;</variable> 2726 2685 </variables> 2727 2686 <slots> … … 2759 2718 <slot>cdMediaChanged()</slot> 2760 2719 <slot>fdMediaChanged()</slot> 2720 <slot>processAdjustSize()</slot> 2761 2721 </slots> 2762 2722 <functions> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h
r951 r1017 265 265 connect (whatsThisTimer, SIGNAL (timeout()), this, SLOT (updateWhatsThis())); 266 266 whatsThisCandidate = NULL; 267 268 whatsThisLabel = new QIRichLabel (this, "whatsThisLabel"); 269 VBoxVMSettingsDlgLayout->addWidget (whatsThisLabel, 2, 1); 270 271 whatsThisLabel->setFocusPolicy (QWidget::NoFocus); 272 whatsThisLabel->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Fixed); 273 whatsThisLabel->setBackgroundMode (QLabel::PaletteMidlight); 274 whatsThisLabel->setFrameShape (QLabel::Box); 275 whatsThisLabel->setFrameShadow (QLabel::Sunken); 276 whatsThisLabel->setMargin (7); 277 whatsThisLabel->setScaledContents (FALSE); 278 whatsThisLabel->setAlignment (int (QLabel::WordBreak | 279 QLabel::AlignJustify | 280 QLabel::AlignTop)); 281 267 282 whatsThisLabel->setTextFormat (Qt::RichText); 268 whatsThisLabel->set MinimumHeight (whatsThisLabel->frameWidth() * 2 +269 270 283 whatsThisLabel->setFixedHeight (whatsThisLabel->frameWidth() * 2 + 284 6 /* seems that RichText adds some margin */ + 285 whatsThisLabel->fontMetrics().lineSpacing() * 3); 271 286 whatsThisLabel->setMinimumWidth (whatsThisLabel->frameWidth() * 2 + 272 287 6 /* seems that RichText adds some margin */ + 273 288 whatsThisLabel->fontMetrics().width ('m') * 40); 289 connect (whatsThisLabel, SIGNAL (textChanged()), this, SLOT (processAdjustSize())); 274 290 275 291 /* … … 655 671 656 672 VBoxGlobal::centerWidget (this, parentWidget()); 673 } 674 675 void VBoxVMSettingsDlg::processAdjustSize() 676 { 677 int newHeight = minimumSize().height(); 678 int oldHeight = height(); 679 if (newHeight > oldHeight) 680 resize (minimumSize()); 657 681 } 658 682
Note:
See TracChangeset
for help on using the changeset viewer.