mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 13:30:34 +01:00
Minor fix : set a correct size of the pixmap displayed in the element properties widget
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4781 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -288,7 +288,6 @@ QWidget *ElementPropertiesWidget::generalWidget()
|
||||
|
||||
//widget for the pixmap
|
||||
QLabel *pix = new QLabel(general_widget);
|
||||
pix->setPixmap(m_element->pixmap().scaled (34, 34, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation));
|
||||
vlayout_->addWidget(pix, 0, Qt::AlignHCenter);
|
||||
vlayout_ -> addStretch();
|
||||
|
||||
@@ -300,7 +299,21 @@ QWidget *ElementPropertiesWidget::generalWidget()
|
||||
QHBoxLayout *hlayout_ = new QHBoxLayout;
|
||||
hlayout_->addWidget(find_in_panel);
|
||||
hlayout_->addWidget(edit_element);
|
||||
|
||||
vlayout_->addLayout(hlayout_);
|
||||
|
||||
//Set the maximum size of the pixmap to the minimum size of the layout
|
||||
QPixmap pixmap = m_element->pixmap();
|
||||
int margin = vlayout_->contentsMargins().left() + vlayout_->contentsMargins().right();
|
||||
int widht_ = vlayout_->minimumSize().width()-margin;
|
||||
|
||||
if (pixmap.size().width() > widht_ || pixmap.size().height() > widht_)
|
||||
{
|
||||
pix->setPixmap(m_element->pixmap().scaled (widht_, widht_, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
}
|
||||
else
|
||||
{
|
||||
pix->setPixmap(pixmap);
|
||||
}
|
||||
|
||||
return general_widget;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user