]> git.lyx.org Git - features.git/commitdiff
Simplify the code that sets the read-only emblem in status bar
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 23 Sep 2016 09:17:20 +0000 (11:17 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 23 Sep 2016 09:18:28 +0000 (11:18 +0200)
Actually QIcon is able to handle transparently the svg icons.

Patch from Enrico.

src/frontends/qt4/GuiView.cpp

index 10ec74e684a5199360ffe34d44390ccbbced7d1c..fdc05a940d659600679773627bcebbcfa85b157e 100644 (file)
@@ -578,17 +578,7 @@ GuiView::GuiView(int id)
        QFontMetrics const fm(statusBar()->fontMetrics());
        int const roheight = max(int(d.normalIconSize), fm.height());
        QSize const rosize(roheight, roheight);
-       QPixmap readonly = QPixmap(rosize);
-       QString imagedir = "images/";
-       FileName fname = imageLibFileSearch(imagedir, "emblem-readonly", "svgz");
-       QSvgRenderer renderer(toqstr(fname.absFileName()));
-       if (renderer.isValid()) {
-               readonly.fill(statusBar()->palette().color(QWidget::backgroundRole()));
-               QPainter painter(&readonly);
-               renderer.render(&painter);
-       } else {
-               readonly = getPixmap("images/", "emblem-readonly", "png").scaled(rosize, Qt::KeepAspectRatio);
-       }
+       QPixmap readonly = QIcon(getPixmap("images/", "emblem-readonly", "svgz,png")).pixmap(rosize);
        read_only_ = new QLabel(statusBar());
        read_only_->setPixmap(readonly);
        read_only_->setScaledContents(true);