PDA

View Full Version : How to get debug output



beggingqt
26th September 2017, 11:20
I've made the simplest possible drawing App - four files.

I build this in the terminal with qmake; make

Sadly there is no output.

I've tried several things - all the suggestions that Mr Google made did not work

Here's the code:

mini.pro



QT += widgets

CONFIG += console

HEADERS = mini.h
SOURCES = mini.cpp main.cpp


main.cpp



#include <QApplication>

#include "mini.h"

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Mini my;
my.show();
return app.exec();
}


mini.h


#ifndef MINI_H
#define MINI_H

#include <QWidget>

class Mini : public QWidget
{
Q_OBJECT

public:
Mini(QWidget *parent = 0);

protected:
void paintEvent(QPaintEvent *event) override;

};

#endif

mini.cpp


#include <QtWidgets>
#include <QDebug>

#include "mini.h"

Mini::Mini(QWidget *parent)
: QWidget(parent)
{
setWindowTitle(tr("Mini Graphics"));
resize(300, 200);
}

void Mini::paintEvent(QPaintEvent * )
{
QColor color;
QPainter painter(this);

qDebug() << "painting";

color.setHsv(100, 255, 191);
painter.setPen(color);
painter.drawLine(50, 50, 100, 150);
}

ado130
26th September 2017, 11:26
The first thing, please put your code into CODE tags and second thing, do you build your program in Debug or Release profile?

beggingqt
26th September 2017, 12:01
Sorry about the Code tag thing - I'm unused this interface

To build the program I typed:



> qmake
> make


In a mac terminal window - I'm not running inside QT Creator.

I don't know what a Debug or Release profile is.

Ginsengelf
26th September 2017, 14:48
Hi, try to add

CONFIG += debug
to your .pro file. This will build the program in debug mode and enable QDebug output.

Ginsengelf

beggingqt
26th September 2017, 15:35
Still no output.

I tried all combinations of debug and console



CONFIG =+ debug
CONFIG += console


But no joy.

A bit of Googling showed that this question has been asked many times
but I could find no satisfactory answer.

Any more ideas?

jefftee
29th September 2017, 03:52
What do you even mean by "debug output"? Are you referring to output from the qDebug() macro that you have added to your code or what are you referring to exactly?