В Win не находится QDesktopWidget. Возможно, он "is deprecated"

main
Artem Proskurnev 3 years ago
parent 3928caef5d
commit 506ccf3dd6
  1. 4
      qtsgraph.cpp
  2. 2
      qtsgraph.h

@ -69,8 +69,8 @@ QTSGraph::QTSGraph(int w, int h, int x, int y, QWidget *parent)
{
if(x < 0 || y < 0)
{
QDesktopWidget desktop;
QRect rect = desktop.availableGeometry(desktop.primaryScreen()); // прямоугольник с размерами экрана
QScreen *scr = QGuiApplication::screens().at(0); //получаем ссылку на основной экран
QRect rect = scr->availableGeometry(); //прямоугольник с размерами экрана
QPoint center = rect.center(); //координаты центра экрана
x = center.x() - w / 2;
y = center.y() - h / 2;

@ -39,7 +39,7 @@ along with Vesi. If not, see <http://www.gnu.org/licenses/>.
#include <QApplication>
#include <QMainWindow>
#include <QPainter>
#include <QDesktopWidget>
#include <QScreen>
#include <QBrush>
#include <QFont>
#include <QPen>

Loading…
Cancel
Save