summaryrefslogtreecommitdiff
path: root/viewimagefs.cpp
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2012-09-26 15:04:18 +0200
committerPeter Wu <lekensteyn@gmail.com>2012-09-26 15:04:18 +0200
commit2497c1392b81e093f4de2541a98746aebd449a7f (patch)
treedb87e59d4c70c677ddb1899d9161b004f6e454ac /viewimagefs.cpp
downloadc-files-2497c1392b81e093f4de2541a98746aebd449a7f.tar.gz
Initial commit
Diffstat (limited to 'viewimagefs.cpp')
-rw-r--r--viewimagefs.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/viewimagefs.cpp b/viewimagefs.cpp
new file mode 100644
index 0000000..ed7b8e8
--- /dev/null
+++ b/viewimagefs.cpp
@@ -0,0 +1,31 @@
+/**
+ * Shows picture arg1 fullscreen
+ * Author: Peter Wu
+ * Date: 2012-09-22
+ */
+#include <QApplication>
+#include <QLabel>
+#include <iostream>
+
+int main (int argc, char **argv) {
+ QApplication app(argc, argv);
+ QStringList args(app.arguments());
+ if (args.size() < 2) {
+ std::cerr << "Usage: " << argv[0] << " filename" << std::endl;
+ return 1;
+ }
+
+ QString filename(args[1]);
+ QPixmap pic(filename);
+ if (!pic) {
+ std::cerr << "Invalid image: " << filename.toStdString() << std::endl;
+ return 1;
+ }
+
+ QLabel lbl;
+ lbl.setCursor(QCursor(Qt::BlankCursor));
+ lbl.setPixmap(pic);
+ lbl.setScaledContents(true);
+ lbl.showFullScreen();
+ return app.exec();
+}