forked from qt-creator/qt-creator
Added outputpane files for qml designer
This commit is contained in:
51
src/plugins/qmldesigner/styledoutputpaneplaceholder.cpp
Normal file
51
src/plugins/qmldesigner/styledoutputpaneplaceholder.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
#include "styledoutputpaneplaceholder.h"
|
||||
|
||||
#include <QtCore/QChildEvent>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtGui/QTabWidget>
|
||||
#include <QtGui/QStackedWidget>
|
||||
#include <QDebug>
|
||||
|
||||
StyledOutputpanePlaceHolder::StyledOutputpanePlaceHolder(Core::IMode *mode, QSplitter *parent) : Core::OutputPanePlaceHolder(mode, parent)
|
||||
{
|
||||
QFile file(":/qmldesigner/outputpane-style.css");
|
||||
file.open(QFile::ReadOnly);
|
||||
QFile file2(":/qmldesigner/scrollbar.css");
|
||||
file2.open(QFile::ReadOnly);
|
||||
m_customStylesheet = file.readAll() + file2.readAll();
|
||||
file.close();
|
||||
file2.close();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void StyledOutputpanePlaceHolder::childEvent(QChildEvent *event)
|
||||
{
|
||||
Core::OutputPanePlaceHolder::childEvent(event);
|
||||
|
||||
if (event->type() == QEvent::ChildAdded) {
|
||||
QWidget *child = qobject_cast<QWidget*>(event->child());
|
||||
if (child) {
|
||||
QList<QTabWidget*> widgets = child->findChildren<QTabWidget*>();
|
||||
if (!widgets.isEmpty()) {
|
||||
QPalette paletteP = palette();
|
||||
paletteP.setBrush(QPalette::All, QPalette::Light, Qt::red);
|
||||
paletteP.setBrush(QPalette::All, QPalette::Shadow, Qt::red);
|
||||
paletteP.setBrush(QPalette::All, QPalette::Dark, Qt::red);
|
||||
paletteP.setBrush(QPalette::All, QPalette::Window, Qt::red);
|
||||
setPalette(paletteP);
|
||||
widgets.first()->parentWidget()->ensurePolished();
|
||||
widgets.first()->parentWidget()->setStyleSheet(m_customStylesheet);
|
||||
}
|
||||
|
||||
}
|
||||
} else if (event->type() == QEvent::ChildRemoved) {
|
||||
QWidget *child = qobject_cast<QWidget*>(event->child());
|
||||
if (child) {
|
||||
QList<QTabWidget*> widgets = child->findChildren<QTabWidget*>();
|
||||
if (!widgets.isEmpty())
|
||||
widgets.first()->parentWidget()->setStyleSheet(QString());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
20
src/plugins/qmldesigner/styledoutputpaneplaceholder.h
Normal file
20
src/plugins/qmldesigner/styledoutputpaneplaceholder.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef STYLEDOUTPUTPANEPLACEHOLDER_H
|
||||
#define STYLEDOUTPUTPANEPLACEHOLDER_H
|
||||
|
||||
#include <coreplugin/outputpane.h>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QChildEvent)
|
||||
|
||||
class StyledOutputpanePlaceHolder : public Core::OutputPanePlaceHolder
|
||||
{
|
||||
public:
|
||||
StyledOutputpanePlaceHolder(Core::IMode *mode, QSplitter *parent = 0);
|
||||
|
||||
protected:
|
||||
void childEvent(QChildEvent *event);
|
||||
private:
|
||||
QString m_customStylesheet;
|
||||
|
||||
};
|
||||
|
||||
#endif // STYLEDOUTPUTPANEPLACEHOLDER_H
|
||||
Reference in New Issue
Block a user