#include "map.h"#include <QTextCodec>#include <QResizeEvent>#include <QDebug>map::map(QWidget *parent) : QWidget(parent){}/*! главная форма */void map::iniMap(){ QTextCodec *codec = QTextCodec::codecForName("CP1251"); QTextCodec::setCodecForTr(codec); setWindowTitle(tr("Карта доступности приемных")); setMinimumSize(1100, 687); verticalLayout = new QVBoxLayout(); QFont font; font.setPointSize(12); font.setBold(true); font.setWeight(75); headerLabel = new QLabel; headerLabel->setText(tr("КАРТА ДОСТУПНОСТИ ПРИЕМНЫХ")); headerLabel->setFont(font); headerLabel->setAlignment(Qt::AlignCenter); headerLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum); mainLabel = new QLabel; mainLabel->setPixmap(QPixmap::fromImage(QImage("map_cr2.png"))); mainLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); mainLabel->setScaledContents(true); pushButtonBack = new QPushButton(this); pushButtonBack->setText(tr("<< Назад")); pushButtonBack->setFont(font); pushButtonBack->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum); verticalLayout->addWidget(headerLabel); verticalLayout->addWidget(mainLabel); verticalLayout->addWidget(pushButtonBack); setLayout(verticalLayout); settings = new QSettings("data_map.ini", QSettings::IniFormat); QTextCodec *codec_ini = QTextCodec::codecForName("CP1251"); settings->setIniCodec(codec_ini); pushButtonSpb = new QPushButton(this); pushButtonMsc = new QPushButton(this); pushButtonSev = new QPushButton(this); pushButtonKalin = new QPushButton(this); pushButtonMurm = new QPushButton(this); pushButtonRost = new QPushButton(this); pushButtonEkb = new QPushButton(this); pushButtonHabar = new QPushButton(this); pushButtonVlad = new QPushButton(this);// QWidgetList widgetList;// widgetList << pushButtonSpb << pushButtonMsc << pushButtonSev << pushButtonKalin << pushButtonMurm// << pushButtonRost << pushButtonEkb << pushButtonHabar << pushButtonVlad;// for (int i = 0; i < widgetList.size(); ++i)// {// widgetList[i]->setStyleSheet("QPushButton {border: none}");// } connect(pushButtonSpb, SIGNAL(clicked()), SLOT(MessageSpb())); connect(pushButtonMsc, SIGNAL(clicked()), SLOT(MessageMsc())); connect(pushButtonSev, SIGNAL(clicked()), SLOT(MessageSev())); connect(pushButtonKalin, SIGNAL(clicked()), SLOT(MessageKalin())); connect(pushButtonMurm, SIGNAL(clicked()), SLOT(MessageMurm())); connect(pushButtonRost, SIGNAL(clicked()), SLOT(MessageRost())); connect(pushButtonEkb, SIGNAL(clicked()), SLOT(MessageEkb())); connect(pushButtonHabar, SIGNAL(clicked()), SLOT(MessageHabar())); connect(pushButtonVlad, SIGNAL(clicked()), SLOT(MessageVlad())); connect(pushButtonBack, SIGNAL(clicked()), this, SLOT(OnClose())); show();}void map::resizeEvent(QResizeEvent *e){ double W = width(); double mW = minimumWidth(); double extraW = W / mW; double H = height(); double mH = minimumHeight(); double extraH = H / mH; pushButtonSpb->setGeometry(170 * extraW, 212 * extraH, 250 * extraW, 39 * extraH); pushButtonMsc->setGeometry(255 * extraW, 270 * extraH, 220 * extraW, 45 * extraH); pushButtonSev->setGeometry(15 * extraW, 308 * extraH, 237 * extraW, 40 * extraH); pushButtonKalin->setGeometry(73 * extraW, 156 * extraH, 240 * extraW, 40 * extraH); pushButtonMurm->setGeometry(245 * extraW, 104 * extraH, 240 * extraW, 40 * extraH); pushButtonRost->setGeometry(190 * extraW, 370 * extraH, 236 * extraW, 38 * extraH); pushButtonEkb->setGeometry(376 * extraW, 439 * extraH, 241 * extraW, 37 * extraH); pushButtonHabar->setGeometry(757 * extraW, 483 * extraH, 255 * extraW, 42 * extraH); pushButtonVlad->setGeometry(840 * extraW, 591 * extraH, 240 * extraW, 40 * extraH); qDebug() << mainLabel->geometry(); qDebug() << W << H << extraW << extraH;}
C++ (Qt)void map::resizeEvent(QResizeEvent *e){ double W = e->size().width(); double mW = minimumWidth(); double extraW = W / mW; double H = e->size().height();...