Skip to content

Commit

Permalink
ticket:5554 Don't stretch the library icon
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Jul 8, 2019
1 parent ae23951 commit dae5757
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions OMEdit/OMEdit/OMEditGUI/Modeling/LibraryTreeWidget.cpp
Expand Up @@ -1710,15 +1710,28 @@ void LibraryTreeModel::loadLibraryTreeItemPixmap(LibraryTreeItem *pLibraryTreeIt
QPainter libraryPainter(&libraryPixmap);
libraryPainter.setRenderHint(QPainter::Antialiasing);
libraryPainter.setRenderHint(QPainter::SmoothPixmapTransform);
libraryPainter.setWindow(rectangle.toRect());
/* Ticket #5554
* Create an equal size square for rendering the scene.
* Don't stretch to fit a square.
*/
QRect windowRect;
windowRect = rectangle.toRect();
if (rectangle.width() != rectangle.height()) {
int x = qMax(rectangle.width(), rectangle.height());
windowRect.setX(-x/2);
windowRect.setY(-x/2);
windowRect.setWidth(x);
windowRect.setHeight(x);
}
libraryPainter.setWindow(windowRect);
libraryPainter.scale(1.0, -1.0);
// drag pixmap
QPixmap dragPixmap(QSize(50, 50));
dragPixmap.fill(QColor(Qt::transparent));
QPainter dragPainter(&dragPixmap);
dragPainter.setRenderHint(QPainter::Antialiasing);
dragPainter.setRenderHint(QPainter::SmoothPixmapTransform);
dragPainter.setWindow(rectangle.toRect());
dragPainter.setWindow(windowRect);
dragPainter.scale(1.0, -1.0);
pGraphicsView->setRenderingLibraryPixmap(true);
// render library pixmap
Expand Down Expand Up @@ -1796,8 +1809,8 @@ void LibraryTreeModel::showModelWidget(LibraryTreeItem *pLibraryTreeItem, bool s
pLibraryTreeItem->setModelWidget(pModelWidget);
}
/* Ticket #3797
* Only show the class Name as window title instead of full path
*/
* Only show the class Name as window title instead of full path
*/
pLibraryTreeItem->getModelWidget()->setWindowTitle(pLibraryTreeItem->getName() + (pLibraryTreeItem->isSaved() ? "" : "*"));
if (show) {
MainWindow::instance()->getModelWidgetContainer()->addModelWidget(pLibraryTreeItem->getModelWidget(), true);
Expand Down

0 comments on commit dae5757

Please sign in to comment.