5
5
5napdragon2021-03-31 20:18:18
Qt
5napdragon, 2021-03-31 20:18:18

Help with c++ error?

This error pops up:

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QtWidgets/QWidget>

#include <QMouseEvent>
#include <QPoint>

#include <QDebug>

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

    this->setWindowFlags(Qt::FramelessWindowHint);      // Отключаем оформление окна
    this->setAttribute(Qt::WA_TranslucentBackground);   // Делаем фон главного виджета прозрачным

}

MainWindow::~MainWindow()
{
    delete ui;
}

//code starts here...

//private:
//{
//    QPointF m_mousePoint;
//};

void MainWindow::on_pushButton_clicked()
{
    QApplication::quit();
}

void QLabel::mouseMoveEvent(QMouseEvent* event)
{
    const QPointF delta = event->globalPosition() - m_mousePoint;
    move(delta.toPoint());

    event->accept();
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2021-03-31
@5napdragon

Declare a variable:QPointF m_mousePoint;

W
Wataru, 2021-03-31
@wataru

Commented out section:

//private:
//{
//    QPointF m_mousePoint;
//};

Must be without curly braces.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question