Qt: add show_windowed_image to qt_utils
This commit is contained in:
@@ -191,5 +191,19 @@ namespace gui
|
|||||||
if (table->horizontalScrollBar())
|
if (table->horizontalScrollBar())
|
||||||
table->removeRow(--item_count);
|
table->removeRow(--item_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void show_windowed_image(const QImage& img, const QString& title)
|
||||||
|
{
|
||||||
|
if (img.isNull())
|
||||||
|
return;
|
||||||
|
|
||||||
|
QLabel* canvas = new QLabel();
|
||||||
|
canvas->setWindowTitle(title);
|
||||||
|
canvas->setObjectName("windowed_image");
|
||||||
|
canvas->setPixmap(QPixmap::fromImage(img));
|
||||||
|
canvas->setFixedSize(img.size());
|
||||||
|
canvas->ensurePolished();
|
||||||
|
canvas->show();
|
||||||
|
}
|
||||||
} // utils
|
} // utils
|
||||||
} // gui
|
} // gui
|
||||||
|
|||||||
@@ -40,5 +40,8 @@ namespace gui
|
|||||||
|
|
||||||
// Recalculates a table's item count based on the available visible space and fills it with empty items
|
// Recalculates a table's item count based on the available visible space and fills it with empty items
|
||||||
void update_table_item_count(QTableWidget* table);
|
void update_table_item_count(QTableWidget* table);
|
||||||
|
|
||||||
|
// Opens an image in a new window with original size
|
||||||
|
void show_windowed_image(const QImage& img, const QString& title = "");
|
||||||
} // utils
|
} // utils
|
||||||
} // gui
|
} // gui
|
||||||
|
|||||||
Reference in New Issue
Block a user