Commit d10e767e authored by Lasse Holmstedt's avatar Lasse Holmstedt
Browse files

Added outputpane files for qml designer

parent 21aebed4
#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());
}
}
}
#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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment