- Timestamp:
- Apr 27, 2007 11:19:45 AM (18 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h
r2357 r2392 36 36 #include <qpopupmenu.h> 37 37 #include <qtooltip.h> 38 #include <qtextedit.h>39 38 40 39 #include <qptrvector.h> … … 134 133 const QUuid machineId; 135 134 const QUuid snapshotId; 136 };137 138 class VBoxTextView : public QTextEdit139 {140 Q_OBJECT141 142 public:143 144 VBoxTextView (QWidget*);145 146 QSize sizeHint() const;147 QSize minimumSizeHint() const;148 149 public slots:150 151 void setText (const QString &);152 135 }; 153 136 … … 406 389 /* public static stuff */ 407 390 408 static void fillPixmapBackGrd(QLabel *);391 static void adoptLabelPixmap (QLabel *); 409 392 410 393 static QString languageId(); -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxUtils.h
r2185 r2392 27 27 #include <qevent.h> 28 28 #include <qlistview.h> 29 #include <qtextedit.h> 29 30 30 31 /** … … 167 168 }; 168 169 170 171 /** 172 * Simple QTextEdit subclass to return its minimumSizeHint() as sizeHint() 173 * for getting more compact layout. 174 */ 175 class QITextEdit : public QTextEdit 176 { 177 public: 178 179 QITextEdit (QWidget *aParent) 180 : QTextEdit (aParent) {} 181 182 QSize sizeHint() const 183 { 184 return minimumSizeHint(); 185 } 186 187 QSize minimumSizeHint() const 188 { 189 /// @todo (r=dmik) this looks a bit meanignless. any comment? 190 int w = 0; 191 int h = heightForWidth (w); 192 return QSize (w, h); 193 } 194 }; 195 169 196 #endif // __VBoxUtils_h__ 170 197 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r2357 r2392 472 472 473 473 #endif /* Q_WS_WIN */ 474 475 VBoxTextView::VBoxTextView (QWidget *aParent)476 : QTextEdit (aParent)477 {478 }479 480 QSize VBoxTextView::sizeHint() const481 {482 return minimumSizeHint();483 }484 485 QSize VBoxTextView::minimumSizeHint() const486 {487 int wid = 0;488 int hei = heightForWidth (wid);489 return QSize (wid, hei);490 }491 492 void VBoxTextView::setText (const QString &aText)493 {494 QTextEdit::setText (aText);495 }496 474 497 475 // VBoxGlobal … … 1848 1826 //////////////////////////////////////////////////////////////////////////////// 1849 1827 1828 /** 1829 * Sets the QLabel background and frame colors according tho the pixmap 1830 * contents. The bottom right pixel of the label pixmap defines the 1831 * background color of the label, the top right pixel defines the color of 1832 * the one-pixel frame around it. This function also sets the alignment of 1833 * the pixmap to AlignVTop (to correspond to the color choosing logic). 1834 * 1835 * This method is useful to provide nice scaling of pixmal labels without 1836 * scaling pixmaps themselves. To see th eeffect, the size policy of the 1837 * label in the corresponding direction (vertical, for now) should be set to 1838 * something like MinimumExpanding. 1839 * 1840 * @todo Parametrize corners to select pixels from and set the alignment 1841 * accordingly. 1842 */ 1843 /* static */ 1844 void VBoxGlobal::adoptLabelPixmap (QLabel *aLabel) 1845 { 1846 AssertReturnVoid (aLabel); 1847 1848 QPixmap *pix = aLabel->pixmap(); 1849 QImage img = pix->convertToImage(); 1850 QRgb rgbBack = img.pixel (img.width() - 1, img.height() - 1); 1851 QRgb rgbFrame = img.pixel (img.width() - 1, 0); 1852 1853 aLabel->setAlignment (AlignTop); 1854 1855 aLabel->setPaletteBackgroundColor (QColor (rgbBack)); 1856 aLabel->setFrameShadow (QFrame::Plain); 1857 aLabel->setFrameShape (QFrame::Box); 1858 aLabel->setPaletteForegroundColor (QColor (rgbFrame)); 1859 } 1860 1850 1861 extern const char *gVBoxLangSubDir = "/nls"; 1851 1862 extern const char *gVBoxLangFileBase = "VirtualBox_"; … … 1874 1885 QByteArray mData; 1875 1886 }; 1876 1877 /**1878 * Fills the QLabel picture background with the color of last1879 * pixel in the pixmap.1880 */1881 /* static */1882 void VBoxGlobal::fillPixmapBackGrd (QLabel *aLabel)1883 {1884 QPixmap *pix = aLabel->pixmap();1885 QImage img = pix->convertToImage();1886 QRgb rgbPixel = img.pixel (img.width() - 1, img.height() - 1);1887 int cRed = qRed (rgbPixel);1888 int cGreen = qGreen (rgbPixel);1889 int cBlue = qBlue (rgbPixel);1890 aLabel->setBackgroundColor (QColor (cRed, cGreen, cBlue));1891 aLabel->setFrameShadow (QFrame::Plain);1892 aLabel->setFrameShape (QFrame::Box);1893 aLabel->setPaletteForegroundColor (QColor (89,121,150));1894 }1895 1887 1896 1888 static VBoxTranslator *sTranslator = 0; -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxNewHDWzd.ui
r2357 r2392 716 716 </includes> 717 717 <forwards> 718 <forward>class VBoxTextView</forward>718 <forward>class QITextEdit</forward> 719 719 </forwards> 720 720 <variables> … … 724 724 <variable access="private">Q_UINT64 maxVDISize;</variable> 725 725 <variable access="private">Q_UINT64 currentSize;</variable> 726 <variable access="private"> VBoxTextView*teSummary;</variable>726 <variable access="private">QITextEdit *teSummary;</variable> 727 727 </variables> 728 728 <slots> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxNewHDWzd.ui.h
r2357 r2392 169 169 * ---------------------------------------------------------------------- */ 170 170 171 /* setup the pictures background color*/172 VBoxGlobal:: fillPixmapBackGrd(pmWelcome);173 VBoxGlobal:: fillPixmapBackGrd(pmType);174 VBoxGlobal:: fillPixmapBackGrd(pmNameAndSize);175 VBoxGlobal:: fillPixmapBackGrd(pmSummary);171 /* setup the label clolors for nice scaling */ 172 VBoxGlobal::adoptLabelPixmap (pmWelcome); 173 VBoxGlobal::adoptLabelPixmap (pmType); 174 VBoxGlobal::adoptLabelPixmap (pmNameAndSize); 175 VBoxGlobal::adoptLabelPixmap (pmSummary); 176 176 177 177 /* Image type page */ … … 216 216 /* Summary page */ 217 217 218 teSummary = new VBoxTextView(pageSummary);218 teSummary = new QITextEdit (pageSummary); 219 219 teSummary->setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Minimum); 220 220 teSummary->setFrameShape (QTextEdit::NoFrame); -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxNewVMWzd.ui
r2357 r2392 1046 1046 <forwards> 1047 1047 <forward>class VBoxMediaComboBox</forward> 1048 <forward>class VBoxTextView</forward>1048 <forward>class QITextEdit</forward> 1049 1049 </forwards> 1050 1050 <variables> … … 1056 1056 <variable access="private">CMachine cmachine;</variable> 1057 1057 <variable access="private">VBoxMediaComboBox *mediaCombo;</variable> 1058 <variable access="private"> VBoxTextView*teSummary;</variable>1058 <variable access="private">QITextEdit *teSummary;</variable> 1059 1059 </variables> 1060 1060 <slots> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxNewVMWzd.ui.h
r2357 r2392 71 71 */ 72 72 73 /* setup the pictures colors*/74 VBoxGlobal:: fillPixmapBackGrd(pmWelcome);75 VBoxGlobal:: fillPixmapBackGrd(pmNameAndOS);76 VBoxGlobal:: fillPixmapBackGrd(pmMemory);77 VBoxGlobal:: fillPixmapBackGrd(pmHDD);78 VBoxGlobal:: fillPixmapBackGrd(pmSummary);73 /* setup the label colors for nice scaling */ 74 VBoxGlobal::adoptLabelPixmap (pmWelcome); 75 VBoxGlobal::adoptLabelPixmap (pmNameAndOS); 76 VBoxGlobal::adoptLabelPixmap (pmMemory); 77 VBoxGlobal::adoptLabelPixmap (pmHDD); 78 VBoxGlobal::adoptLabelPixmap (pmSummary); 79 79 80 80 /* Name and OS page */ … … 122 122 /* Summary page */ 123 123 124 teSummary = new VBoxTextView(pageSummary);124 teSummary = new QITextEdit (pageSummary); 125 125 teSummary->setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Minimum); 126 126 teSummary->setFrameShape (QTextEdit::NoFrame);
Note:
See TracChangeset
for help on using the changeset viewer.