Skip to content

Instantly share code, notes, and snippets.

@danadam
Last active September 27, 2015 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danadam/1346485 to your computer and use it in GitHub Desktop.
Save danadam/1346485 to your computer and use it in GitHub Desktop.
Qt Terminus font test
#include <QApplication>
#include <QWidget>
#include <QScrollArea>
#include <QGridLayout>
#include <QLabel>
#include <QPushButton>
#include <QFont>
#include <QVBoxLayout>
#include <iostream>
int main(int argc, char * argv[])
{
QApplication app(argc, argv);
std::cout << "compiled with Qt " << QT_VERSION_STR << ", run with Qt " << qVersion() << std::endl;
QScrollArea * scrollArea = new QScrollArea();
QWidget * container = new QWidget(scrollArea);
scrollArea->setWidget(container);
scrollArea->setWidgetResizable(true);
QGridLayout * layout = new QGridLayout(container);
for (int i = 0; i <= 11; ++i)
{
const int size = i + 8;
QLabel * label = new QLabel(QString("size %1:").arg(size));
QPushButton * button = new QPushButton(QObject::trUtf8("aAcCeElLnNoOsSzZzZ\nąĄćĆęĘłŁńŃóÓśŚźŹżŻ"));
// QPushButton * button = new QPushButton(QObject::trUtf8("aAeEoO\näÄëËöÖ"));
button->setFont(QFont("Terminus", size));
layout->addWidget(label, i, 0);
layout->addWidget(button, i, 1);
}
QWidget widget;
QVBoxLayout * outerLayout = new QVBoxLayout(&widget);
outerLayout->addWidget(scrollArea);
widget.resize(400, 400);
widget.show();
return app.exec();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment