Skip to content

Commit

Permalink
Minor cleanup of icon positions.
Browse files Browse the repository at this point in the history
  • Loading branch information
baumgarr committed Jul 26, 2017
1 parent 56ab14d commit cb09863
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 14 deletions.
4 changes: 2 additions & 2 deletions gui/browserWidgets/tagviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void TagViewer::showEvent(QShowEvent* event) {
void TagViewer::resize() {
QFontMetrics fm(font());
int width = fm.width(text());
int height = fm.height();
int height = fm.descent();

// setMaximumWidth(width+sz.width()+2+clearButton->minimumWidth());
// setMinimumWidth(width+sz.width()+2+clearButton->minimumWidth());
Expand All @@ -88,7 +88,7 @@ void TagViewer::resize() {

int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
clearButton->move(rect().left() + width + frameWidth,
(rect().bottom()- height - 5 )/2);
(rect().top()- height)/2);
}


Expand Down
8 changes: 6 additions & 2 deletions gui/favoritesview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ FavoritesView::FavoritesView(QWidget *parent) :
connect(deleteShortcut, SIGNAL(activated()), this, SLOT(deleteRequested()));

root->setExpanded(true);
this->setProperty("animated", false);

resetSize();
}

Expand Down Expand Up @@ -323,10 +325,12 @@ void FavoritesView::drawBranches(QPainter *painter, const QRect &rect, const QMo
painter->save();
if (isExpanded(index)) {
int offset = rect.width()-expandedImage->width()-1;
painter->drawImage(offset, rect.y()+(expandedImage->height()/4),*expandedImage);
int voffset = (rect.height() - expandedImage->height()) / 2;
painter->drawImage(offset, rect.y()+voffset,*expandedImage);
} else {
int offset = rect.width()-collapsedImage->width()-1;
painter->drawImage(offset, rect.y()+(collapsedImage->height()/4),*collapsedImage);
int voffset = (rect.height() - collapsedImage->height()) / 2;
painter->drawImage(offset, rect.y()+voffset,*collapsedImage);
}
painter->restore();
return;
Expand Down
9 changes: 7 additions & 2 deletions gui/nattributetree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,9 @@ NAttributeTree::NAttributeTree(QWidget *parent) :
this->setFrameShape(QFrame::NoFrame);
expandedImage = new QImage(":expandedIcon");
collapsedImage = new QImage(":collapsedIcon");

this->setProperty("animated", false);

}

NAttributeTree::~NAttributeTree() {
Expand Down Expand Up @@ -552,10 +555,12 @@ void NAttributeTree::drawBranches(QPainter *painter, const QRect &rect, const QM
painter->save();
if (isExpanded(index)) {
int offset = rect.width()-expandedImage->width()-1;
painter->drawImage(offset, rect.y()+(expandedImage->height()/4),*expandedImage);
int voffset = (rect.height() - expandedImage->height()) / 2;
painter->drawImage(offset, rect.y()+voffset,*expandedImage);
} else {
int offset = rect.width()-collapsedImage->width()-1;
painter->drawImage(offset, rect.y()+(collapsedImage->height()/4),*collapsedImage);
int voffset = (rect.height() - collapsedImage->height()) / 2;
painter->drawImage(offset, rect.y()+voffset,*collapsedImage);
}
painter->restore();
return;
Expand Down
10 changes: 6 additions & 4 deletions gui/nnotebookview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ NNotebookView::NNotebookView(QWidget *parent) :

expandedImage = new QImage(":expandedIcon");
collapsedImage = new QImage(":collapsedIcon");

this->setProperty("animated", false);
}


Expand Down Expand Up @@ -1039,15 +1041,15 @@ void NNotebookView::drawBranches(QPainter *painter, const QRect &rect, const QMo
if (!index.child(0,0).isValid())
return;

QLOG_DEBUG() << expandedImage->size();

painter->save();
if (isExpanded(index)) {
int offset = rect.width()-expandedImage->width()-1;
painter->drawImage(offset, rect.y()+(expandedImage->height()/4),*expandedImage);
int voffset = (rect.height() - expandedImage->height()) / 2;
painter->drawImage(offset, rect.y()+voffset,*expandedImage);
} else {
int offset = rect.width()-collapsedImage->width()-1;
painter->drawImage(offset, rect.y()+(collapsedImage->height()/4),*collapsedImage);
int voffset = (rect.height() - collapsedImage->height()) / 2;
painter->drawImage(offset, rect.y()+voffset,*collapsedImage);
}
painter->restore();
return;
Expand Down
7 changes: 5 additions & 2 deletions gui/nsearchview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ NSearchView::NSearchView(QWidget *parent) :
expandedImage = new QImage(":expandedIcon");
collapsedImage = new QImage(":collapsedIcon");

this->setProperty("animated", false);
}


Expand Down Expand Up @@ -494,10 +495,12 @@ void NSearchView::drawBranches(QPainter *painter, const QRect &rect, const QMode
painter->save();
if (isExpanded(index)) {
int offset = rect.width()-expandedImage->width()-1;
painter->drawImage(offset, rect.y()+(expandedImage->height()/4),*expandedImage);
int voffset = (rect.height() - expandedImage->height()) / 2;
painter->drawImage(offset, rect.y()+voffset,*expandedImage);
} else {
int offset = rect.width()-collapsedImage->width()-1;
painter->drawImage(offset, rect.y()+(collapsedImage->height()/4),*collapsedImage);
int voffset = (rect.height() - collapsedImage->height()) / 2;
painter->drawImage(offset, rect.y()+voffset,*collapsedImage);
}
painter->restore();
return;
Expand Down
8 changes: 6 additions & 2 deletions gui/ntagview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ NTagView::NTagView(QWidget *parent) :
this->setFrameShape(QFrame::NoFrame);
expandedImage = new QImage(":expandedIcon");
collapsedImage = new QImage(":collapsedIcon");

this->setProperty("animated", false);
}


Expand Down Expand Up @@ -933,10 +935,12 @@ void NTagView::drawBranches(QPainter *painter, const QRect &rect, const QModelIn
painter->save();
if (isExpanded(index)) {
int offset = rect.width()-expandedImage->width()-1;
painter->drawImage(offset, rect.y()+(expandedImage->height()/4),*expandedImage);
int voffset = (rect.height() - expandedImage->height()) / 2;
painter->drawImage(offset, rect.y()+voffset,*expandedImage);
} else {
int offset = rect.width()-collapsedImage->width()-1;
painter->drawImage(offset, rect.y()+(collapsedImage->height()/4),*collapsedImage);
int voffset = (rect.height() - collapsedImage->height()) / 2;
painter->drawImage(offset, rect.y()+voffset,*collapsedImage);
}
painter->restore();
return;
Expand Down

0 comments on commit cb09863

Please sign in to comment.