Example #1
0
QVariant ResourceModel::keyboardLayoutData(int row, int role) const
{
    switch(role)
    {
    case KCategorizedSortFilterProxyModel::CategorySortRole:
        return QVariant(1);
    case KCategorizedSortFilterProxyModel::CategoryDisplayRole:
        return QVariant(i18n("Keyboard Layouts"));
    case Qt::DisplayRole:
        return QVariant(m_dataIndex->keyboardLayout(row)->title());
    case Qt::ToolTipRole:
        return QVariant(i18n("Name: %1", m_dataIndex->keyboardLayout(row)->name()));
    case Qt::DecorationRole:
        return QVariant(resourceIcon(m_dataIndex->keyboardLayout(row)->source()));
    case ResourceModel::ResourceTypeRole:
        return QVariant(ResourceModel::KeyboardLayoutItem);
    case ResourceModel::DataRole:
        return QVariant::fromValue<QObject*>(m_dataIndex->keyboardLayout(row));
    case ResourceModel::KeyboardLayoutNameRole:
        return QVariant(m_dataIndex->keyboardLayout(row)->name());
    case ResourceModel::PathRole:
        return QVariant(m_dataIndex->keyboardLayout(row)->path());
    case ResourceModel::IndexRole:
        return QVariant(row);
    case ResourceModel::SourceRole:
        return QVariant(m_dataIndex->keyboardLayout(row)->source());
    default:
        return QVariant();
    }
}
Example #2
0
//=======================================================================
//private
bool Application::registerClass ()
{
   WNDCLASSEX wcex;
   wcex.cbSize          = sizeof(WNDCLASSEX);
   wcex.style			   = resourceStyle();
   wcex.lpfnWndProc	   = WndProc;
   wcex.cbClsExtra	   = resourceCLSExtra();
   wcex.cbWndExtra	   = resourceWndExtra();
   wcex.hInstance		   = instance();
   wcex.hIcon			   = (resourceIconID() == -1 ? resourceIcon() : LoadIcon( instance(), MAKEINTRESOURCE( resourceIconID() )));
   wcex.hCursor		   = (resourceCursorID() == -1 ? resourceCursor() : LoadCursor( NULL, MAKEINTRESOURCE( resourceCursorID() )));
   wcex.hbrBackground	= resourceBackground();
   wcex.lpszMenuName	   = (resourceMenuID() == -1 ? resourceMenu() : MAKEINTRESOURCE( resourceMenuID() ));
   wcex.lpszClassName   = resourceClassName();
   wcex.hIconSm		   = (resourceIconSmallID() == -1 ? resourceIconSmall() : LoadIcon( instance(), MAKEINTRESOURCE( resourceIconSmallID() ) ));
   return (RegisterClassEx(&wcex) != NULL);
}