当前位置: 首页>>代码示例>>C++>>正文


C++ QScreen::availableSize方法代码示例

本文整理汇总了C++中QScreen::availableSize方法的典型用法代码示例。如果您正苦于以下问题:C++ QScreen::availableSize方法的具体用法?C++ QScreen::availableSize怎么用?C++ QScreen::availableSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QScreen的用法示例。


在下文中一共展示了QScreen::availableSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QQmlApplicationEngine engine;

    QQmlContext* context = engine.rootContext();

    QString currPath = QDir::currentPath();
    context->setContextProperty("currentPath", currPath);

    QScreen *screen = QApplication::screens().at(0);
    int width = screen->availableSize().width();
    context->setContextProperty("availableWidth", width);
    int height = screen->availableSize().height();
    context->setContextProperty("availableHeight", height);

    MainController* mainController = new MainController();
    context->setContextProperty("mainController", mainController);

    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    return app.exec();
}
开发者ID:Slesa,项目名称:Trinity,代码行数:23,代码来源:main.cpp

示例2: QDialog

LoginDialog::LoginDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::LoginDialog)
{
    ui->setupUi(this);

	QScreen *screen = QApplication::screens().at(0);
	//int screenWidth = screen->availableSize().width();
	int screenHeight = screen->availableSize().height();

    QFont defaultHeight;
	defaultHeight.setPointSize(18);

	int ButtonHeight = screenHeight / 20;

    ui->label_User->setText("Benutzername:");
    ui->label_User->setFont(defaultHeight);
    ui->label_password->setText("Passwort:");
    ui->label_password->setFont(defaultHeight);
	ui->label_IP_login->setText("Server Url/IP:");
    ui->label_IP_login->setFont(defaultHeight);

    ui->pushButton_OK->setText("OK");
    ui->pushButton_OK->setMaximumHeight(ButtonHeight);
    ui->pushButton_cancel->setText("Abbrechen");
    ui->pushButton_cancel->setMaximumHeight(ButtonHeight);

	ui->lineEdit_password->setEchoMode(QLineEdit::Password);

    ui->label_headline->setAlignment(Qt::AlignCenter);
    QFont font = ui->label_headline->font();                                        //Set layout of label
    font.setBold(true);
	font.setPointSize(screenHeight / 60);
    ui->label_headline->setFont(font);
    ui->label_headline->setText("HWWS Login");

    QString IP = settingsIP.value("Url", "").toString();
    ui->lineEdit_IP_login->setText(IP);

	QString User = settingsUser.value("name", "").toString();
    ui->lineEdit_user->setText(User);

	QString Password = settingsUser.value("password", "").toString();
    ui->lineEdit_password->setText(Password);
}
开发者ID:woegi,项目名称:HWWS_ANDROID_APP,代码行数:45,代码来源:logindialog.cpp


注:本文中的QScreen::availableSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。