#include <QStyle>QStyle standart_style;
src/editor.cpp:196: ошибка: cannot declare variable 'standart_style' to be of abstract type 'QStyle'/usr/local/Trolltech/Qt-4.4.1/include/QtGui/qstyle.h:71: замечание: because the following virtual functions are pure within 'QStyle':/usr/local/Trolltech/Qt-4.4.1/include/QtGui/qstyle.h:215: замечание: virtual void QStyle::drawPrimitive(QStyle::PrimitiveElement, const QStyleOption*, QPainter*, const QWidget*) const/usr/local/Trolltech/Qt-4.4.1/include/QtGui/qstyle.h:284: замечание: virtual void QStyle::drawControl(QStyle::ControlElement, const QStyleOption*, QPainter*, const QWidget*) const...
void setNonEditMode( QWidget& Widget , bool bNonEditMode ){ // Проход по QLineEdit - там для соответствующего изменения их ReadOnly и FocusPolicy QList<QLineEdit*> LE_List = Widget.findChildren<QLineEdit*>(); for ( QList<QLineEdit*>::iterator it = LE_List.begin(); it != LE_List.end(); it++ ) { (*it)->setReadOnly( bNonEditMode ); if ( bNonEditMode ) (*it)->setFocusPolicy(Qt::NoFocus); else (*it)->setFocusPolicy(Qt::StrongFocus); }; // Проход по QLabel - лам для соответствующего изменения их Enabled QList<QLabel*> LB_List = Widget.findChildren<QLabel*>(); for ( QList<QLabel*>::iterator it = LB_List.begin(); it != LB_List.end(); it++ ) { (*it)->setEnabled( !bNonEditMode ); };};
C++ (Qt) QPalette pal = this->palette(); for (int i = 0; i < 25; ++i) pal.setColor(QPalette::Active, (QPalette::ColorRole)i, pal.color(QPalette::Disabled,(QPalette::ColorRole)i)); ui->progressBar->setPalette(pal);
C++ (Qt)void editor::set_textarea_editable(bool editable){ static int firstrunflag=0; static QPalette standart_palette; if(firstrunflag==0) { standart_palette=textarea->palette(); firstrunflag=1; } if(editable==true) { textarea->setTextInteractionFlags(Qt::TextEditorInteraction); textarea->setPalette(standart_palette); } else { textarea->setTextInteractionFlags(Qt::TextBrowserInteraction); QPalette plt=standart_palette; QColor inactive_color; inactive_color=plt.color(QPalette::Disabled, QPalette::Base); plt.setColor(QPalette::Normal, QPalette::Base, inactive_color); textarea->setPalette(plt); }}
QPalette pal = ui.textEdit->palette(); pal.setColor(QPalette::Active, QPalette::Base, qApp->palette().color(QPalette::Disabled, QPalette::Window)); ui.textEdit->setPalette(pal);