Results 1 to 6 of 6

Thread: How to get debug output

  1. #1
    Join Date
    Sep 2017
    Posts
    5
    Qt products
    Qt5
    Platforms
    MacOS X

    Default How to get debug output

    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:aintEvent(QPaintEvent * )
    {
    QColor color;
    QPainter painter(this);

    qDebug() << "painting";

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

  2. #2
    Join Date
    Jan 2017
    Posts
    58
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to get debug output

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

  3. #3
    Join Date
    Sep 2017
    Posts
    5
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: How to get debug output

    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.

  4. #4
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    518
    Thanks
    13
    Thanked 77 Times in 75 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to get debug output

    Hi, try to add
    Qt Code:
    1. CONFIG += debug
    To copy to clipboard, switch view to plain text mode 
    to your .pro file. This will build the program in debug mode and enable QDebug output.

    Ginsengelf

  5. #5
    Join Date
    Sep 2017
    Posts
    5
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: How to get debug output

    Still no output.

    I tried all combinations of debug and console

    Qt Code:
    1. CONFIG =+ debug
    2. CONFIG += console
    To copy to clipboard, switch view to plain text mode 

    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?

  6. #6
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: How to get debug output

    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?
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

Similar Threads

  1. QT debug output
    By KingOfHeart in forum Qt Programming
    Replies: 3
    Last Post: 7th May 2011, 02:28
  2. Notifications of exceptions in debug output
    By piotr.dobrogost in forum Qt Programming
    Replies: 0
    Last Post: 21st September 2009, 20:21
  3. Replies: 2
    Last Post: 20th July 2007, 16:34
  4. QT4 debug mode output / QList: Out of memory
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 29th May 2007, 09:53
  5. qmake and debug output
    By mattie in forum Qt Programming
    Replies: 7
    Last Post: 18th September 2006, 22:33

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.