- Timestamp:
- Apr 22, 2008 3:46:25 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxHardDiskSettings.ui.h
r8282 r8301 165 165 setListBox (new QListBox (this)); 166 166 167 setFocusPolicy (QWidget::NoFocus); 167 168 refresh(); 168 169 mUniq->subscribe (this); 169 qApp->installEventFilter (this);170 170 connect (mUniq, SIGNAL (listChanged()), this, SLOT (refresh())); 171 connect (mUniq, SIGNAL (listChanged()), this, SLOT (updateToolTip())); 171 172 connect (this, SIGNAL (activated (int)), mUniq, SIGNAL (listChanged())); 172 173 connect (this, SIGNAL (textChanged()), mUniq, SIGNAL (listChanged())); … … 227 228 } 228 229 230 void updateToolTip() 231 { 232 QString oldTip = QToolTip::textFor (this); 233 QString newTip = currentText(); 234 235 if (newTip != oldTip) 236 { 237 QToolTip::remove (this); 238 QToolTip::add (this, newTip); 239 } 240 } 241 229 242 signals: 230 243 … … 232 245 233 246 private: 234 235 bool eventFilter (QObject *aObject, QEvent *aEvent)236 {237 if (aObject != listBox())238 return false;239 240 if (aEvent->type() == QEvent::Hide)241 hide();242 243 return QComboBox::eventFilter (aObject, aEvent);244 }245 247 246 248 HDSlotUniquizer *mUniq; … … 263 265 , mItem (aItem) 264 266 { 265 qApp->installEventFilter (this);267 setFocusPolicy (QWidget::NoFocus); 266 268 connect (&vboxGlobal(), 267 269 SIGNAL (mediaRemoved (VBoxDefs::DiskType, const QUuid &)), … … 277 279 278 280 private: 279 280 bool eventFilter (QObject *aObject, QEvent *aEvent)281 {282 if (aObject != listBox())283 return false;284 285 if (aEvent->type() == QEvent::Hide)286 hide();287 288 return VBoxMediaComboBox::eventFilter (aObject, aEvent);289 }290 281 291 282 QListViewItem *mItem; … … 415 406 { 416 407 if (mVector [mFocusColumn]->count()) 417 {418 mVector [mFocusColumn]->show();419 408 mVector [mFocusColumn]->popup(); 420 }421 409 } 422 410 … … 482 470 cb->resize (wc, hc); 483 471 484 QColorGroup cg (aColorGroup); 485 if (aColumn == mFocusColumn) 486 { 487 cg.setColor (QColorGroup::Base, aColorGroup.highlight()); 488 cg.setColor (QColorGroup::Text, aColorGroup.highlightedText()); 489 } 490 QListViewItem::paintCell (aPainter, cg, aColumn, aWidth, aAlign); 491 } 492 493 void paintFocus (QPainter *aPainter, const QColorGroup &aColorGroup, 494 const QRect &aRect) 495 { 496 if (mFocusColumn != -1) 497 { 498 int indent = 0; 499 for (int i = 0; i < mFocusColumn; ++ i) 500 indent = listView()->columnWidth (i); 501 502 QRect newFocus (QPoint (aRect.x() + indent, aRect.y()), 503 QSize (listView()->columnWidth (mFocusColumn), 504 aRect.height())); 505 506 QListViewItem::paintFocus (aPainter, aColorGroup, newFocus); 507 } 472 if (aColumn == mFocusColumn && cb->isHidden()) 473 cb->show(); 474 else if (aColumn != mFocusColumn && !cb->isHidden()) 475 cb->hide(); 476 477 QListViewItem::paintCell (aPainter, aColorGroup, aColumn, aWidth, aAlign); 478 } 479 480 void paintFocus (QPainter *, const QColorGroup &, const QRect &) 481 { 482 /* Do not paint focus, because it presented by combo-box */ 508 483 } 509 484 … … 920 895 static_cast<HDListItem*> (clickedItem) : 0; 921 896 922 if (item) 923 item->showEditor(); 924 else if (mAddAttachmentAct->isEnabled()) 897 if (!item && mAddAttachmentAct->isEnabled()) 925 898 addHDItem(); 926 899 break; … … 930 903 { 931 904 if (aObject != mLvHD->viewport()) 905 { 906 if (!QToolTip::textFor (mLvHD->viewport()).isNull()) 907 QToolTip::remove (mLvHD->viewport()); 932 908 break; 909 } 933 910 934 911 QMouseEvent *e = static_cast<QMouseEvent*> (aEvent);
Note:
See TracChangeset
for help on using the changeset viewer.