Пример #1
0
    SimpleListViewPrivate(SimpleListView *button) 
        : m_content(0)
        , m_layout(0)
        , m_twoColumns(false)
        , q_ptr(button)
#if (QT_VERSION >= 0x040600)
        , m_listItemCaching(false)
#endif
    {
        Q_Q(SimpleListView);

        m_layout = new QGraphicsGridLayout();
        m_layout->setContentsMargins(0, 0, 0, 0);
        m_layout->setSpacing(0);
        m_layout->setColumnSpacing(0,0);
        m_layout->setColumnSpacing(1,0);
        m_layout->setRowSpacing(0,0);
        m_layout->setRowSpacing(1,0);
        m_content = new QGraphicsWidget;
        m_content->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
        m_content->setParentItem(q->viewport());
        m_content->setLayout(m_layout);

        q->horizontalScrollBar()->setSliderSize(0.0);

        QObject::connect(Theme::p(), SIGNAL(themeChanged()), q, SLOT(themeChange()));
    }
Пример #2
0
BackgroundItem::BackgroundItem(const QString &filename, QGraphicsWidget *parent)
    : GvbWidget(parent),
      m_background(),
      m_fileName(filename)
{
    setContentsMargins(0,0,0,0);

    connect(Theme::p(), SIGNAL(themeChanged()), this, SLOT(themeChange()));
}
Пример #3
0
TopBar::TopBar(QGraphicsView* mainView, QGraphicsWidget* parent) :
    GvbWidget(parent), m_mainView(mainView), m_isLimeTheme(false),
    m_orientation(TopBar::None), m_topBarPixmap(), m_sizesBlue(), m_sizesLime()
{
    setDefaultSizes();
    
    m_titleFont = Theme::p()->font(Theme::TitleBar);
    m_statusFont = Theme::p()->font(Theme::StatusBar);

    connect(Theme::p(), SIGNAL(themeChanged()), this, SLOT(themeChange()));
}
Пример #4
0
void Menu::init()
{
    m_ButtonContainer = new QList<Button*>;

    m_Layout->setContentsMargins(0,0,0,0);
    m_Layout->setSpacing(0);

    setMinimumWidth(150);

    setLayout(m_Layout);

    connect(Theme::p(), SIGNAL(themeChanged()), this, SLOT(themeChange()));
}
Пример #5
0
ItemRecyclingList::ItemRecyclingList(const int itemBuffer, QGraphicsWidget * parent)
    : ItemRecyclingListView(parent),
      m_listModel(new ListModel(this))
{    
    ListItemContainer *container = new ListItemContainer(itemBuffer, this, this);
    container->setParentItem(this);
    ItemRecyclingListView::setContainer(container);
    ItemRecyclingListView::setModel(m_listModel, new RecycledListItem(this));
    setObjectName("ItemRecyclingList");
    connect(Theme::p(), SIGNAL(themeChanged()), this, SLOT(themeChange()));

    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
Пример #6
0
bool KWindow::event(QEvent * e)
{
	if(e->type() == KThemeChangeEvent::EventType)
	{
		themeChange((KThemeChangeEvent*)e);
		return true;
	}
	else if(e->type() == QEvent::Move)
	{
		emit posChanged();
		return true;
	}
	return __super::event(e);
}
Пример #7
0
void KNThemeManager::loadTheme(const QString &themeFilePath)
{
    QFile themeFile(themeFilePath);
    //Check the theme file exist or not. Open the file as ReadOnly mode.
    if(!themeFile.exists() || !themeFile.open(QIODevice::ReadOnly))
    {
        return;
    }
    //Read the data and close the file.
    QJsonObject themeData=QJsonDocument::fromJson(themeFile.readAll()).object();
    themeFile.close();
    //Generate the temporary palette map and name hash list.
    //We don't write it to palette list to avoid the bad file.
    QHash<QString, QPalette> paletteList;
    //Parse the theme data.
    QStringList paletteNames=themeData.keys();
    for(QStringList::iterator i=paletteNames.begin();
        i!=paletteNames.end();
        ++i)
    {
        //Check whether we have loaded this name before.
        if(paletteList.contains(*i))
        {
            continue;
        }
        //Parse the data.
        parsePalette(*i, &themeData, paletteList);
    }
    //Check the new map is available or not.
    if(!paletteList.isEmpty())
    {
        //Save the palette map.
        m_paletteList=paletteList;
        //Update all the widget's palette in the widget list.
        for(QLinkedList<QWidget *>::iterator i=m_widgetList.begin();
            i!=m_widgetList.end();
            ++i)
        {
            (*i)->setPalette(getPalette((*i)->objectName()));
        }
        //Emit the theme change signal.
        emit themeChange();
    }
}