Exemple #1
0
void Messages::createWidgets() {
    m_buttonsWidget  = new QWidget        (this);
    m_console        = new QPlainTextEdit (this);
    m_copyButton     = new QPushButton    (QChar (fa::copy),   this);
    m_clearButton    = new QPushButton    (QChar (fa::trash),  this);

    m_console->setReadOnly  (true);
    m_console->setFont      (Languages::monoFont());
    m_copyButton->setFont   (AWESOME()->font (DPI_SCALE (12)));
    m_clearButton->setFont  (AWESOME()->font (DPI_SCALE (12)));

    connect (m_copyButton,  &QPushButton::clicked, this, &Messages::copy);
    connect (m_clearButton, &QPushButton::clicked, this, &Messages::clear);
    connect (QDS(),          &DriverStation::newMessage,
             this,          &Messages::registerMessage);
}
void Console::configureStyles()
{
    /* Set console font */
    QFont consoleFont;
#if defined Q_OS_WIN
    consoleFont.setFamily     ("Consolas");
    consoleFont.setPixelSize  (DPI_SCALE (12));
#else
    consoleFont.setFamily     ("Inconsolata");
    consoleFont.setPixelSize  (DPI_SCALE (12));
#endif
    m_console->setFont        (consoleFont);

    /* Change the fonts of the buttons */
    m_copyButton->setFont     (AWESOME()->font (DPI_SCALE (12)));
    m_clearButton->setFont    (AWESOME()->font (DPI_SCALE (12)));

    /* Set tooltips */
    m_console->setToolTip     (tr ("Displays robot messages and logs"));
    m_copyButton->setToolTip  (tr ("Copy the console log"));
    m_clearButton->setToolTip (tr ("Clear the console window"));
}