本文整理汇总了C++中QDesktopWidget函数的典型用法代码示例。如果您正苦于以下问题:C++ QDesktopWidget函数的具体用法?C++ QDesktopWidget怎么用?C++ QDesktopWidget使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QDesktopWidget函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
//qDebug() << additionEvent("Olegrok");
qDebug() << *(int*)QThread::currentThreadId();
ui->setupUi(this);
this->setGeometry(QDesktopWidget().availableGeometry().width()/2 - this->width()/2,
QDesktopWidget().availableGeometry().height()/2 - this->width()/2,
this->width(), this->height());
auth.setUpProfile(&account);
addfriend.setUpProfile(&account);
connect(&auth, &authwindow::showMainWindow, this, &MainWindow::windowInit, Qt::UniqueConnection);
connect(&addfriend, &AddFriend::sendContact, this, &MainWindow::addContact, Qt::UniqueConnection);
connect(&opt, &Options::logoutProfile, this, &MainWindow::logoutProfile, Qt::UniqueConnection);
connect(&account, &Profile::authorizationError, this, &MainWindow::logout, Qt::UniqueConnection);
connect(&account, &Profile::updateWindow, this, &MainWindow::updateWindow, Qt::UniqueConnection);
connect(&account, SIGNAL(logout(QString)), this, SLOT(logout(QString)), Qt::DirectConnection);
connect(ui->lineFindLogin, SIGNAL(textChanged(const QString&)), this, SLOT(findContact(const QString&)));
connect(ui->lineFindMsg, SIGNAL(textChanged(const QString&)), this, SLOT(changeMsgLineEvent(const QString&)));
connect(account.getMonitor_ptr(), SIGNAL(authorizationError()), this, SLOT(logout()));
auth.show();
// this->show();
// ui->ContactsList->addItem("Green");
// ui->ContactsList->findItems("Green", Qt::MatchExactly).first()->setBackgroundColor(Qt::green);
// //ui->ContactsList->findItems("Green", Qt::MatchExactly).first()->setBackground(Qt::gray);
}
示例2: QDialog
ScreenshotEditWidget::ScreenshotEditWidget(QPixmap* source) :
QDialog(NULL),
_selectedTool(ST_CustomDraw),
_toolActive(false),
_source(source),
_newPixmap(*source),
ui(new Ui::ScreenshotEditWidget)
{
QString new_color = Application::settings().GetParameter("color", DEFAULT_COLOR);
_color = QColor(new_color);
ui->setupUi(this);
this->setGeometry(0, 0,
source->width() + ui->colorDisplayWidget->x() * 2,
ui->screenshotDisplayWidget->y() + source->height() +
ui->colorDisplayWidget->height() + 10);
int minWidth = ui->clearButton->x() + ui->clearButton->width() + ui->colorDisplayWidget->x();
if (this->width() < minWidth) {
this->setGeometry(this->x(), this->y(), minWidth, this->height());
}
ui->screenshotDisplayWidget->setGeometry(width() / 2 - source->width() / 2,
ui->screenshotDisplayWidget->y(),
source->width(), source->height());
this->move(QDesktopWidget().availableGeometry().center().x() - (this->width() / 2),
QDesktopWidget().availableGeometry().center().y() - (this->height() / 2));
ui->buttonBox->setGeometry(ui->buttonBox->x(),
ui->screenshotDisplayWidget->y() + ui->screenshotDisplayWidget->height() + 10,
this->width() - ui->buttonBox->x() * 2 - 20,
ui->buttonBox->height());
this->setFixedSize(this->size());
}
示例3: Q_D
qreal Screen::dpi() const
{
Q_D(const Screen);
qreal sdpi = 0.0;
#ifdef CALCULATE_DPI
int w = width();
int h = height();
qreal physicalDisplaySize = 0.0;
if (w*h == 640*360)
physicalDisplaySize = 3.5;
else if (w*h == 640*480)
physicalDisplaySize = 2.46;
else if (w*h == 320*240)
physicalDisplaySize = 2.8;
else if (w*h == 800*480)
physicalDisplaySize = 3.5;
else
physicalDisplaySize = 3.5;
qreal width_r = w;
qreal height_r = h;
sdpi = sqrt(width_r*width_r + height_r*height_r) / physicalDisplaySize;
#else
sdpi = QDesktopWidget().physicalDpiX();
#endif
#ifdef TRACE_SCREEN
qDebug() << "dpi=" <<sdpi <<", logicalX="<<QDesktopWidget().logicalDpiX()
<<", logicalY="<<QDesktopWidget().logicalDpiY()
<<", physicalX="<<QDesktopWidget().physicalDpiX()
<<", physicalY="<<QDesktopWidget().physicalDpiY();
#endif
return sdpi;
}
示例4: QWidget
TLoginWindow::TLoginWindow()
: QWidget(NULL)
{
qDebug() << Q_FUNC_INFO;
this->setFixedSize(LOGIN_WINDOW_WIDTH, LOGIN_WINDOW_HEIGHT_NOCAPTCHA);
this->setGeometry(QDesktopWidget().availableGeometry().center().x() - (this->width() / 2),
QDesktopWidget().availableGeometry().center().y() - (this->height() / 2),
this->width(), this->height());
QGridLayout* layout = new QGridLayout(this);
QLabel* loginLabel = new QLabel(tr("Login:"), this);
layout->addWidget(loginLabel, 0, 0);
QLabel* passwordLabel = new QLabel(tr("Password:"), this);
layout->addWidget(passwordLabel, 1, 0);
CaptchaImageWidget = new QWidget(this);
CaptchaImageWidget->setFixedSize(0, 0);
layout->addWidget(CaptchaImageWidget, 2, 0, 1, 2);
QLabel* captchaLabel = new QLabel(tr("Captcha:"), this);
layout->addWidget(captchaLabel, 3, 0);
LoginEdit = new QLineEdit(this);
layout->addWidget(LoginEdit, 0, 1);
PasswordEdit = new QLineEdit(this);
layout->addWidget(PasswordEdit, 1, 1);
CaptchaEdit = new QLineEdit(this);
layout->addWidget(CaptchaEdit, 3, 1);
CaptchaEdit->setEnabled(false);
LoginButton = new QPushButton(tr("Login"), this);
connect(LoginButton.data(), &QPushButton::clicked, this,
&TLoginWindow::OnLoginButtonClicked);
layout->addWidget(LoginButton, 4, 0);
RegisterButton = new QPushButton(tr("Register"), this);
connect(RegisterButton.data(), &QPushButton::clicked, this,
&TLoginWindow::OnRegisterButtonClicked);
layout->addWidget(RegisterButton, 4, 1);
layout->setColumnMinimumWidth(0, 120);
layout->setColumnMinimumWidth(1, 120);
this->show();
}
示例5: QDesktopWidget
QRect WinSnippingArea::getFullScreenRect() const
{
QRect fullScreenRect = QDesktopWidget().rect();
auto screenCount = QDesktopWidget().screenCount();
for(int i = 0; i < screenCount; i++) {
auto screenRect = QDesktopWidget().screenGeometry(i);
if(screenRect.x() < fullScreenRect.x()) {
fullScreenRect.moveLeft(screenRect.x());
}
if(screenRect.y() < fullScreenRect.y()) {
fullScreenRect.moveBottom(screenRect.y());
}
}
return fullScreenRect;
}
示例6: FriendLogin
TChatWindow::TChatWindow(const QString& frndLogin)
: FriendLogin(frndLogin)
{
this->setGeometry(QDesktopWidget().availableGeometry().center().x() - (CHAT_WINDOW_WIDTH / 2),
QDesktopWidget().availableGeometry().center().y() - (CHAT_WINDOW_HEIGHT / 2),
CHAT_WINDOW_WIDTH, CHAT_WINDOW_HEIGHT);
this->setWindowTitle(frndLogin);
MessagesModel.setStringList(Messages);
QVBoxLayout* currentLayout = new QVBoxLayout(this);
CallStatusLabel = new QLabel(this);
CallStatusLabel->setStyleSheet("QLabel { font-size: 12px; font: bold; }");
currentLayout->addWidget(CallStatusLabel.data());
CallStatusLabel->hide();
CallButton = new QPushButton(this);
currentLayout->addWidget(CallButton.data());
connect(CallButton.data(), &QPushButton::clicked, this, &TChatWindow::OnCallClicked);
DeclineButton = new QPushButton(this);
currentLayout->addWidget(DeclineButton.data());
connect(DeclineButton.data(), &QPushButton::clicked, [this] () {
CallStatus = NVocal::CAS_NotCalling;
UpdateCallStatus();
emit OnFinishCall(FriendLogin);
});
UpdateCallStatus();
QListView* messagesListView = new QListView();
messagesListView->setModel(&MessagesModel);
currentLayout->addWidget(messagesListView);
MessageEdit = new TChatMessageEdit();
connect(MessageEdit.data(), &TChatMessageEdit::SendMessage, this, &TChatWindow::OnSendMessage);
MessageEdit->setFixedHeight(CHAT_MESSAGE_HEIGHT);
currentLayout->addWidget(MessageEdit);
RingSound = new QSound(":/sounds/ring.wav");
RingSound->setLoops(-1);
CallSound = new QSound(":/sounds/call.wav");
CallSound->setLoops(-1);
this->show();
}
示例7: emit
void PreviewWidget::zoomOut()
{
m_currentZoom -= m_zoomStep;
if (m_currentZoom < m_zoomMin)
m_currentZoom = m_zoomMin;
emit(zoomChanged((int)((m_currentZoom/((double)QDesktopWidget().screen()->width()/(screen_widthMM*10)))*100 + 0.5)));
}
示例8: getSetting
/** Restores the last size and location of the window. */
void
VidaliaWindow::restoreWindowState()
{
#if QT_VERSION >= 0x040200
QByteArray geometry = getSetting("Geometry", QByteArray()).toByteArray();
if (geometry.isEmpty())
adjustSize();
else
restoreGeometry(geometry);
#else
QRect screen = QDesktopWidget().availableGeometry();
/* Restore the window size. */
QSize size = getSetting("Size", QSize()).toSize();
if (!size.isEmpty()) {
size = size.boundedTo(screen.size());
resize(size);
}
/* Restore the window position. */
QPoint pos = getSetting("Position", QPoint()).toPoint();
if (!pos.isNull() && screen.contains(pos)) {
move(pos);
}
#endif
}
示例9: QDialog
SplashScreen::SplashScreen( QWidget* parent ) : QDialog( parent )
{
setupUi( this );
// On top + no decoration
setWindowFlags( Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint );
// Center of the screen
QRect rect = frameGeometry();
rect.moveCenter( QDesktopWidget().availableGeometry().center() );
move( rect.topLeft() );
// Information
lAppName->setGraphicsEffect( new EffectDropShadow( 0, 0, "white", lAppName ) );
lAppName->setText( Alexandra::appNameGui );
lVersion->setGraphicsEffect( new EffectDropShadow( 0, 0, "white", lVersion ) );
lVersion->setText( QString( "version %1").arg( Alexandra::appVersionFull ) );
lAuthor->setGraphicsEffect( new EffectDropShadow( 0, 0, "white", lAuthor ) );
lAuthor->setText( Alexandra::appAuthor );
lWebsite->setGraphicsEffect( new EffectDropShadow( 0, 0, "white", lWebsite ) );
lWebsite->setText( Alexandra::appWebsite );
lLoading->setGraphicsEffect( new EffectDropShadow( 0, 0, "white", lLoading ) );
}
示例10: frameGeometry
void
MainWindow::centralizeFrame()
{
QRect frect = frameGeometry();
frect.moveCenter(QDesktopWidget().availableGeometry().center());
move(frect.topLeft());
}
示例11: setCentralWidgetPropreties
void Widget::setCentralWidgetPropreties()
{
this->setWindowTitle("Vadim Khakham & Gilad Eini Soduku Solver using sat4j");
this->resize(QDesktopWidget().availableGeometry(this).size() * 0.7);
mainLayout = new QVBoxLayout;
this->setLayout(mainLayout);
}
示例12: QMainWindow
MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
/*kozepre teszi a nyito kepernyot*/
QRect available_geom = QDesktopWidget().availableGeometry();
QRect current_geom = frameGeometry();
setGeometry(available_geom.width() / 2 - current_geom.width() / 2,
available_geom.height() / 2 - current_geom.height() / 2,
current_geom.width(),
current_geom.height());
/********************************/
connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));
connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(MenTXT()));
connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
connect(ui->actionBinom, SIGNAL(triggered()), this, SLOT(binom()) );
connect(ui->actionHelp, SIGNAL(triggered()), this, SLOT(showHelp()));
connect(ui->actionPrint, SIGNAL(triggered()), this, SLOT(printIt()));
ui->mainToolBar->addAction(ui->actionSave);
ui->mainToolBar->addAction(ui->actionPrint);
ui->mainToolBar->addSeparator();
ui->mainToolBar->addAction(ui->actionBinom);
ui->mainToolBar->addSeparator();
ui->mainToolBar->addAction(ui->actionHelp);
verzio = "2010-03-03";
settingClear();
}
示例13: QDesktopWidget
QPoint ThemepackLoader::widgetPos(const QString &name)
{
d->mSettings->beginGroup(name);
int x = 0;
int y = 0;
QRect screenRect = QDesktopWidget().availableGeometry();
QString x_value = d->mSettings->value("x").toString();
QString y_value = d->mSettings->value("y").toString();
QRegExp rx("(\\d+)");
rx.indexIn(x_value, 0);
qDebug() << Q_FUNC_INFO << "Parsed Value" << rx.cap(1);
x = rx.cap(1).toUInt();
x = (screenRect.width()/100) * x;
rx.indexIn(y_value, 0);
y = rx.cap(1).toUInt();
y = (screenRect.height()/100) * y;
qDebug() << Q_FUNC_INFO << x << ": " << y;
d->mSettings->endGroup();
return QPoint(x, y);
}
示例14: QDialog
frmNapiProjektUpload::frmNapiProjektUpload(QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f)
{
ui.setupUi(this);
setAttribute(Qt::WA_QuitOnClose, false);
connect(ui.pbSelectDirectory, SIGNAL(clicked()), this, SLOT(selectDirectory()));
connect(ui.leSelectDirectory, SIGNAL(textChanged(QString)), this, SLOT(leSelectDirectoryChanged()));
connect(ui.pbScan, SIGNAL(clicked()), this, SLOT(pbScanClicked()));
connect(&scanThread, SIGNAL(scanFinished(bool)), this, SLOT(scanFinished(bool)));
connect(&scanThread, SIGNAL(folderChange(QString)), this, SLOT(folderChange(QString)));
connect(ui.pbUpload, SIGNAL(clicked()), this, SLOT(pbUploadClicked()));
connect(&uploadThread, SIGNAL(finished()), this, SLOT(uploadFinished()));
connect(&uploadThread, SIGNAL(progressChange(int)), ui.pbProgress, SLOT(setValue(int)));
connect(&uploadThread, SIGNAL(fileNameChange(QString)), this, SLOT(fileNameChange(QString)));
connect(&uploadThread, SIGNAL(checkingUserPass()), this, SLOT(checkingUserPass()));
connect(&uploadThread, SIGNAL(invalidUserPass()), this, SLOT(invalidUserPass()));
if(QFileInfo(GlobalConfig().previousDialogPath()).isDir())
ui.leSelectDirectory->setText(GlobalConfig().previousDialogPath());
QRect position = frameGeometry();
position.moveCenter(QDesktopWidget().availableGeometry().center());
move(position.topLeft());
}
示例15: QMainWindow
SMGui::SMGui(QWidget *parent) :
QMainWindow(parent)
{
QRect available_geom = QDesktopWidget().availableGeometry();
QRect current_geom = frameGeometry();
setGeometry(available_geom.width() / 2 - current_geom.width() / 2,
available_geom.height() - current_geom.height() / 2,
current_geom.width()/2,
current_geom.height()/2);
this->setMaximumHeight(400);
this->setMaximumWidth(300);
vlayout = new QVBoxLayout;
vGroup = new QGroupBox;
vGroup->setLayout(vlayout);
widgetlayout = new QVBoxLayout;
centralWidget = new QWidget;
this->setMaximumWidth(300);
this->show();
Logger::getInstance().log("creating GUI", 1);
}