Changeset 1109 for s10k


Ignore:
Timestamp:
Feb 16, 2019, 6:23:09 PM (6 years ago)
Author:
s10k
Message:

small dialogs functions changes, now they have an optional value to set as rich text

Location:
s10k/CommonUtils
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • s10k/CommonUtils/LICENSE

    r1095 r1109  
    11MIT License
    22
    3 Copyright (c) 2017 random-guy
     3Copyright (C) 2017 - 2018 Fábio Bento (fabiobento512)
    44
    55Permission is hereby granted, free of charge, to any person obtaining a copy
  • s10k/CommonUtils/README.md

    r1095 r1109  
    11# CommonUtils
    2 Common C++ Qt Utils for random-guy projects
     2Common C++ Qt Utils for fabiobento512 projects
  • s10k/CommonUtils/util.cpp

    r1095 r1109  
    11/**
    2  * Copyright (C) 2017 - Fábio Bento (random-guy)
     2 * Copyright (C) 2017 - 2018 Fábio Bento (fabiobento512)
    33 *
    44 * This library is distributed under the MIT License. See notice at the end
     
    266266namespace Dialogs {
    267267
    268 void showInfo(const QString &message){
     268void showInfo(const QString &message, const bool richText){
    269269    QMessageBox msgBox;
     270        if(richText){
     271                msgBox.setTextFormat(Qt::RichText);
     272        }
    270273    msgBox.setIcon(QMessageBox::Information);
    271274    msgBox.setText(message);
     
    273276}
    274277
    275 void showRichInfo(const QString &message){
     278void showWarning(const QString &message, const bool richText){
    276279    QMessageBox msgBox;
    277     msgBox.setTextFormat(Qt::RichText);
    278     msgBox.setIcon(QMessageBox::Information);
    279     msgBox.setText(message);
    280     msgBox.exec();
    281 }
    282 
    283 void showWarning(const QString &message){
    284     QMessageBox msgBox;
     280        if(richText){
     281                msgBox.setTextFormat(Qt::RichText);
     282        }
    285283    msgBox.setIcon(QMessageBox::Warning);
    286284    msgBox.setText(message);
     
    288286}
    289287
    290 void showError(const QString &message){
     288void showError(const QString &message, const bool richText){
    291289    QMessageBox msgBox;
    292     msgBox.setIcon(QMessageBox::Critical);
    293     msgBox.setText(message);
    294     msgBox.exec();
    295 }
    296 
    297 void showRichError(const QString &message){
    298     QMessageBox msgBox;
     290        if(richText){
     291                msgBox.setTextFormat(Qt::RichText);
     292        }
    299293    msgBox.setIcon(QMessageBox::Critical);
    300294    msgBox.setText(message);
     
    538532namespace StatusBar {
    539533
     534void showInfo(QStatusBar * const statusBar, const QString &message){
     535
     536    QPalette myPalete = QPalette();
     537    myPalete.setColor( QPalette::WindowText, QColor(0,38,255));
     538    statusBar->setPalette( myPalete );
     539    statusBar->showMessage(message,10000); //display by 10 seconds
     540
     541}
     542
    540543void showError(QStatusBar * const statusBar, const QString &message){
    541544
     
    563566
    564567/**
    565  * Copyright (c) 2017 - Fábio Bento (random-guy)
     568 * Copyright (c) 2017 - 2018 Fábio Bento (fabiobento512)
    566569 *
    567570 * Permission is hereby granted, free of charge, to any person
  • s10k/CommonUtils/util.h

    r1095 r1109  
    11/**
    2  * Copyright (C) 2017 - Fábio Bento (random-guy)
     2 * Copyright (C) 2017 - 2018 Fábio Bento (fabiobento512)
    33 *
    44 * This library is distributed under the MIT License. See notice at the end
     
    9696namespace Dialogs {
    9797
    98 void showInfo(const QString &message);
     98void showInfo(const QString &message, const bool richText = false);
    9999
    100 void showRichInfo(const QString &message);
     100void showWarning(const QString &message, const bool richText = false);
    101101
    102 void showWarning(const QString &message);
    103 
    104 void showError(const QString &message);
    105 
    106 void showRichError(const QString &message);
     102void showError(const QString &message, const bool richText = false);
    107103
    108104bool showQuestion(QWidget * parent, QString message, QMessageBox::StandardButton standardButton=QMessageBox::NoButton);
     
    151147namespace StatusBar {
    152148
     149void showInfo(QStatusBar * const statusBar, const QString &message);
    153150void showError(QStatusBar * const statusBar, const QString &message);
    154151void showSuccess(QStatusBar * const  statusBar,const QString &message);
     
    162159
    163160/**
    164  * Copyright (c) 2017 - Fábio Bento (random-guy)
     161 * Copyright (c) 2017 - 2018 Fábio Bento (fabiobento512)
    165162 *
    166163 * Permission is hereby granted, free of charge, to any person
Note: See TracChangeset for help on using the changeset viewer.