Esempio n. 1
0
DownloadManager::DownloadManager(QWidget *parent)
    : QDialog(parent)
    , m_autoSaver(new AutoSaver(this))
    , m_manager(new NetworkAccessManager(this))
    , m_iconProvider(0)
    , m_removePolicy(Never)
    , ui(new Ui_DownloadManager())
{
    ui->setupUi(this);
    ui->downloadsView->setShowGrid(false);
    ui->downloadsView->verticalHeader()->hide();
    ui->downloadsView->horizontalHeader()->hide();
    ui->downloadsView->setAlternatingRowColors(true);
    ui->downloadsView->horizontalHeader()->setStretchLastSection(true);
    m_model = new DownloadModel(this);
    ui->downloadsView->setModel(m_model);
    connect(ui->cleanupButton, SIGNAL(clicked()), this, SLOT(cleanup()));
    load();

    Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance();
    QDockWidget* dw = pDockMgr->addDockWindow(QT_TR_NOOP("Download Manager"),
        this, Qt::BottomDockWidgetArea);
    dw->setFeatures(QDockWidget::DockWidgetMovable|
                    QDockWidget::DockWidgetFloatable|
                    QDockWidget::DockWidgetClosable);
    dw->setAttribute(Qt::WA_DeleteOnClose);
    dw->show();
}
void ExecutingPietLibraries::MakeGLView (std::vector<PietTree> & pt){
    if(pt.size() == 0 )return;
    if(pt[0].isLeaf()) return;
    pt = pt[0].Nodes();

    if(pt.size() < 3) return;
    int w = pt[0].Val();
    int h = pt[1].Val();
    QString title = pt[2].toString();
    for(int i:range(3)) pt.pop_back();
    GLGameWidget* glgw = GLGameWidget::MakeUniqueGLWidget(nullptr);
    if(glgw == nullptr) return ;
    glgw->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
    glgw->setSize(w,h);

    QDockWidget* dw = new QDockWidget(nullptr);
    dw->setFloating(true);
    dw->setAllowedAreas(Qt::NoDockWidgetArea);
    dw->connect(dw,&QDockWidget::dockLocationChanged,[=](){ dw->setFloating(true);});
    dw->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
    dw->setWidget(glgw);
    dw->setAttribute(Qt::WA_DeleteOnClose);
    dw->setWindowTitle(title);
    dw->show();
}
Esempio n. 3
0
QDockWidget* PluginAPI::createMainWindowDock(Qt::DockWidgetArea dockWidgetArea, const QString& title)
{
	QDockWidget* dock = new QDockWidget(title, m_mainWindow);
	dock->setAllowedAreas(Qt::AllDockWidgetAreas);
	dock->setAttribute(Qt::WA_DeleteOnClose);
	m_mainWindow->addDockWidget(dockWidgetArea, dock);
	m_mainWindow->addViewAction(dock->toggleViewAction());
	return dock;
}
Esempio n. 4
0
void BaseWidget::addDock(QWidget *w)
{
	QDockWidget *dock = new QDockWidget(w->windowTitle(),this);
	dock->setObjectName(w->windowTitle());
	addDockWidget(Qt::LeftDockWidgetArea, dock);
	
	dock->setWidget(w);
	dock->setAttribute(Qt::WA_DeleteOnClose);
	dock->show();
	
	docks.append(dock);
	
	connect(dock, SIGNAL(destroyed(QObject*)), this, SLOT(dock_destroyed_cb(QObject *)));
}
Esempio n. 5
0
void MainWindow::createHeader()
{
//    QToolBar *tb = new QToolBar(this);
    QDockWidget *header = new QDockWidget(this);
    QHBoxLayout *ly = new QHBoxLayout();
    QFrame *frm = new QFrame();
    QPushButton *pbExit = new QPushButton();
    pbExit->setIcon(QIcon(":/images/meiti-up.png"));
    pbExit->setIconSize(QSize(40,40));

    pbExit->setFocusPolicy(Qt::NoFocus);
    pbExit->setFocusProxy(0);
    pbExit->setStyleSheet(QString("background-image: url(:/images/meiti-up.png);\n\n#pbExit:pressed {background-image: url(:/images/meiti-down.png) 4 4 4 4 strech strech;}\n\n#pbExit:hover {background-image: url(:/images/meiti-over.png) 4 4 4 4 strech strech;}\n"));

    connect(pbExit, SIGNAL(clicked()), qApp, SLOT(quit()));


    ly->addWidget(pbExit);
    ly->setAlignment(pbExit,Qt::AlignCenter);
    frm->setLayout(ly);
    frm->setAttribute(Qt::WA_TranslucentBackground, true);        // 设置背景透明(version >= QT4.5

    header->setWidget(frm);

    header->setAttribute(Qt::WA_TranslucentBackground, true);        // 设置背景透明(version >= QT4.5

    //header->setWindowFlags(Qt::FramelessWindowHint);
    header->setWindowTitle(QString(""));
    header->setTitleBarWidget(new QWidget);
    header->setFocusPolicy(Qt::NoFocus);
    header->setFocusProxy(0);
    header->setFeatures(QDockWidget::NoDockWidgetFeatures);
    header->setBaseSize(0,40);

    addDockWidget(Qt::TopDockWidgetArea,header, Qt::Horizontal);

//    tb->addWidget(frm);
//    pbExit->setText(QString("%1--%2--%3").arg(this->width()).arg(tb->width()).arg(pbExit->width()));
//
//    tb->setMovable(false);
//
//    this->addToolBar(tb);

//	dockWidget->setWidget(keyboardfrm);
//	dockWidget->setAllowedAreas(Qt::BottomDockWidgetArea);
//	dockWidget->setFeatures(QDockWidget::DockWidgetClosable);
//	addDockWidget(Qt::BottomDockWidgetArea,dockWidget);
}
Esempio n. 6
0
void MainWindowImpl::launchNewBoardView()
{
    const qreal zm(0.25);
    QBoardView * v = new QBoardView( this->impl->gstate );
    v->zoom(zm);
	QDockWidget * win = new QDockWidget( "QBoard View", this );
	win->setAttribute(Qt::WA_DeleteOnClose);
#if 0
	QWidget * frame = new QWidget();
	QGridLayout * lay = new QGridLayout(frame);
	lay->setSpacing(1);
	lay->setContentsMargins(2,2,2,2);
	lay->addWidget( v );
	win->setWidget(frame);
	this->addDockWidget(Qt::RightDockWidgetArea, win );
#else
	win->setWidget( v );
	this->addDockWidget(Qt::RightDockWidgetArea, win );
#endif
}
void ProtobufTree::contextMenuEvent(QContextMenuEvent* e) {
    QMenu menu;

    QAction* expandItemAction = nullptr, * collapseItemAction = nullptr;
    QTreeWidgetItem* item = itemAt(e->pos());
    if (item) {
        expandItemAction = menu.addAction("Expand");
        collapseItemAction = menu.addAction("Collapse");
        menu.addSeparator();
    }

    QAction* expandMessagesAction = menu.addAction("Expand Only Messages");
    menu.addSeparator();

    QAction* expandAction = menu.addAction("Expand All");
    QAction* collapseAction = menu.addAction("Collapse All");
    menu.addSeparator();

    QAction* showTags = menu.addAction("Show tags");
    showTags->setCheckable(true);
    showTags->setChecked(!isColumnHidden(Column_Tag));

    menu.addSeparator();

    QAction* chartAction = nullptr;
    QList<QAction*> chartMenuActions;

    QList<QDockWidget*> dockWidgets;
    const FieldDescriptor* field = nullptr;
    if (mainWindow && item) {
        field = item->data(Column_Tag, FieldDescriptorRole)
                    .value<const FieldDescriptor*>();
        if (field) {
            int t = field->type();
            if (t == FieldDescriptor::TYPE_FLOAT ||
                t == FieldDescriptor::TYPE_DOUBLE ||
                (t == FieldDescriptor::TYPE_MESSAGE &&
                 field->message_type()->name() == "Point")) {
                dockWidgets = mainWindow->findChildren<QDockWidget*>();
                if (!dockWidgets.isEmpty()) {
                    QMenu* chartMenu = menu.addMenu("Chart");
                    chartAction = chartMenu->addAction("New Chart");
                    chartMenu->addSeparator();
                    for (int i = 0; i < dockWidgets.size(); ++i) {
                        chartMenuActions.append(chartMenu->addAction(
                            QString("Add to '%1'")
                                .arg(dockWidgets[0]->windowTitle())));
                    }
                } else {
                    chartAction = menu.addAction("New Chart");
                }
            }
        }
    }

    QAction* act = menu.exec(mapToGlobal(e->pos()));
    if (act == expandMessagesAction) {
        collapseAll();
        expandMessages();
    } else if (act == expandAction) {
        expandAll();
    } else if (act == collapseAction) {
        collapseAll();
    } else if (act == showTags) {
        setColumnHidden(Column_Tag, !showTags->isChecked());
    } else if (expandItemAction && act == expandItemAction) {
        expandSubtree(item);
    } else if (collapseItemAction && act == collapseItemAction) {
        collapseSubtree(item);
    } else if (chartAction && act == chartAction) {
        // Find the path from LogFrame to the chosen item
        QVector<int> path;
        QStringList names;
        for (QTreeWidgetItem* i = item; i; i = i->parent()) {
            int tag = i->data(Column_Tag, Qt::DisplayRole).toInt();
            path.push_back(tag);
            names.append(i->text(Column_Field));
        }

        reverse(path.begin(), path.end());
        reverse(names.begin(), names.end());

        QDockWidget* dock = new QDockWidget(names.join("."), mainWindow);
        StripChart* chart = new StripChart(dock);
        chart->history(_history);

        if (field->type() == FieldDescriptor::TYPE_MESSAGE) {
            Chart::PointMagnitude* f = new Chart::PointMagnitude;
            f->path = path;
            chart->function(f);
        } else {
            Chart::NumericField* f = new Chart::NumericField;
            f->path = path;
            chart->function(f);
        }
        dock->setAttribute(Qt::WA_DeleteOnClose);
        dock->setWidget(chart);
        mainWindow->addDockWidget(Qt::BottomDockWidgetArea, dock);
        if (updateTimer) {
            connect(updateTimer, SIGNAL(timeout()), chart, SLOT(update()));
        }
    } else if (chartMenuActions.size() > 0) {
        int i = chartMenuActions.indexOf(act);
        if (i != -1) {
            StripChart* chart = (StripChart*)dockWidgets[i]->widget();
            QVector<int> path;
            QStringList names;
            for (QTreeWidgetItem* i = item; i; i = i->parent()) {
                int tag = i->data(Column_Tag, Qt::DisplayRole).toInt();
                path.push_back(tag);
                names.append(i->text(Column_Field));
            }

            reverse(path.begin(), path.end());
            reverse(names.begin(), names.end());

            dockWidgets[i]->setWindowTitle(dockWidgets[i]->windowTitle() +
                                           ", " + names.join("."));
            chart->history(_history);

            if (field->type() == FieldDescriptor::TYPE_MESSAGE) {
                Chart::PointMagnitude* f = new Chart::PointMagnitude;
                f->path = path;
                chart->function(f);
            } else {
                Chart::NumericField* f = new Chart::NumericField;
                f->path = path;
                chart->function(f);
            }

            if (updateTimer) {
                connect(updateTimer, SIGNAL(timeout()), chart, SLOT(update()));
            }
        }
    }
}
Esempio n. 8
0
bool MainWindowImpl::loadFile( QFileInfo const & fi )
{
    if( ! fi.isFile() ) return false;
	// FIXME: this dispatch needs to be generalized.
	QString fn( fi.filePath() ); // fi.absoluteFilePath() );
	bool worked = false;
	if( impl->gstate.board().fileNameMatches(fn) )
	{
		worked = impl->gstate.board().s11nLoad(fn);
	}
	else if( impl->gstate.fileNameMatches(fn) )
	{
		worked = this->loadGame(fn);
	}
	else if( fn.endsWith(".wiki") )
	{
	    worked = true;
	    QString lbl = QString("Wiki: %1").arg(fi.fileName());
	    QDockWidget * win = new QDockWidget( lbl, this );
	    qboard::WikiLiteView * v = new qboard::WikiLiteView;
	    win->setAttribute(Qt::WA_DeleteOnClose);
	    win->setWidget( v );
	    win->move( impl->gv->viewport()->mapToGlobal(QPoint(0,0)) );
	    win->resize( impl->gv->viewport()->size() );
	    win->setFloating(true);
	    this->addDockWidget(Qt::RightDockWidgetArea, win );
	    v->parseFile(fn);
	    win->setWindowTitle( v->windowTitle() );
	}
	else if( QRegExp("\\.[jq]s$",Qt::CaseInsensitive).indexIn(fn) > 0 )
	{
	    QScriptEngine & js( impl->gstate.jsEngine() );
	    qDebug() << "[ running script"<<fn<<"]";
	    QScriptValue rv = qboard::jsInclude( &js, fn );
	    if( rv.isError() )
	    {
		QStringList bt( js.uncaughtExceptionBacktrace() );
		QScriptValue exv = rv.isError() ? rv : js.uncaughtException();
		QString msg("Script threw or returned an exception:\n");
		msg += exv.toString()
		    + "\nBacktrace:\n"
		    + bt.join("\n");
		QMessageBox::warning( this, "JavaScript Exception",
				      msg,
				      QMessageBox::Ok, QMessageBox::Ok );
		worked = false;
	    }
	    else
	    {
		worked = true;
	    }
	    qDebug() << "[ done running script"<<fn<<"]";
	}
	else if( QRegExp("\\.(html|txt)$",Qt::CaseInsensitive).indexIn(fn) > 0 )
	{
#if QT_VERSION >= 0x040400
		QBoardDocsBrowser * b = new QBoardDocsBrowser;
		b->setHome(fn);
		b->setWindowTitle(fn);
		b->show();
		worked = true;
#else
		QMessageBox::warning( this, "Not implemented!",
				      "MainWindowImpl::loadFile(*.{txt,html}) not implemented for Qt < 4.4",
				      QMessageBox::Ok, QMessageBox::Ok );
		worked = false;
#endif
	}
	else if( QRegExp("\\.(png|jpg|gif|xpm|svg|bmp)$",Qt::CaseInsensitive).indexIn(fn) > 0 )
	{ // ^^^ FIXME: get the list of image formats from somewhere dynamic
		const size_t threshold = 10 * 1024;
		// ^^^ fixme: ^^^^ do this based on image resolution, not file size, cuz many
		// large-sized PNGs are quite small.
		if( fi.size() < threshold )
		{
			worked = this->loadPiece(fi);
		}
		else
		{
			worked = this->impl->gstate.board().s11nLoad(fn); // fi.absoluteFilePath());
		}
	}
	if( worked )
	{
		this->statusBar()->showMessage("Loaded: "+fn); // fi.absoluteFilePath());
	}
	else
	{
		this->statusBar()->showMessage("Load FAILED: "+fn); // fi.absoluteFilePath());
	}
	return worked;
}
Esempio n. 9
0
void SearchResultWidget::setupUi(QMainWindow *qmw, const QString &iconThemePath)
{
	QDockWidget *searchResultWidget = 0;
	QString dockTitle = sectionName+":"+phrase;
	dockTitle.replace("==", tr("Radifs that contain: "));
	dockTitle.replace("=", tr("Rhymed by: "));
	searchResultWidget = new QDockWidget(dockTitle, qmw);
	searchResultWidget->setObjectName(QString::fromUtf8("searchResultWidget_new"));//object name for created instance, it renames to 'searchResultWidget_old'
	//searchResultWidget->setLayoutDirection(Qt::RightToLeft);
	searchResultWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
	searchResultWidget->setAttribute(Qt::WA_DeleteOnClose, true);

	QGridLayout *searchGridLayout = new QGridLayout(searchResultContents);
	searchGridLayout->setSpacing(6);
	searchGridLayout->setContentsMargins(11, 11, 11, 11);
	searchGridLayout->setObjectName(QString::fromUtf8("searchGridLayout"));
	QHBoxLayout *horizontalLayout = new QHBoxLayout();
	horizontalLayout->setSpacing(6);
	horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
	QGridLayout *searchTableGridLayout = new QGridLayout();
	searchTableGridLayout->setSpacing(6);
	searchTableGridLayout->setObjectName(QString::fromUtf8("gridLayout_3"));

	//create filter lable and lineEdit and layout
	QHBoxLayout *filterHorizontalLayout = new QHBoxLayout();
	filterHorizontalLayout->setSpacing(6);
	filterHorizontalLayout->setObjectName(QString::fromUtf8("filterHorizontalLayout"));

	QLabel *filterLabel = new QLabel(searchResultContents);
	filterLabel->setObjectName(QString::fromUtf8("filterLabel"));
	filterLabel->setText(tr("Filter:"));
	filterHorizontalLayout->addWidget(filterLabel, 0, Qt::AlignRight|Qt::AlignCenter);
	
	QString clearIconPath = iconThemePath+"/clear-left.png";
	if (searchResultContents->layoutDirection() == Qt::RightToLeft)
		clearIconPath = iconThemePath+"/clear-right.png";
	filterLineEdit = new QSearchLineEdit(searchResultContents, clearIconPath, iconThemePath+"/filter.png");
	filterLineEdit->setObjectName(QString::fromUtf8("filterLineEdit"));
#if QT_VERSION > 0x040700
	filterLineEdit->setPlaceholderText(tr("Filter"));
#endif
	connect(filterLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterResults(const QString &)));
	filterHorizontalLayout->addWidget(filterLineEdit);
	QSpacerItem *filterHorizSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
	filterHorizontalLayout->addItem(filterHorizSpacer);

	pageLabel = new QLabel(searchResultContents);
	pageLabel->setObjectName(QString::fromUtf8("pageLabel"));
//	filterHorizontalLayout->addWidget(pageLabel, 0, Qt::AlignRight|Qt::AlignCenter);

	//searchTableGridLayout->addLayout(filterHorizontalLayout, 1, 0, 1, 1);

	//create QTableWidget
	searchTable = new QTableWidget(searchResultContents);
	searchTable->setObjectName(QString::fromUtf8("searchTable"));
	searchTable->setColumnCount(3);
	searchTable->setLayoutDirection(Qt::RightToLeft);
	searchTable->setAlternatingRowColors(true);
	searchTable->setSelectionMode(QAbstractItemView::NoSelection);
	searchTable->setSelectionBehavior(QAbstractItemView::SelectRows);
	searchTable->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
	searchTable->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
	searchTable->verticalHeader()->setVisible(false);
	//searchTable->horizontalHeader()->setVisible(false);
	searchTable->horizontalHeader()->setHighlightSections(false);
	searchTable->horizontalHeader()->setStretchLastSection(true);

	//install delagate on third column
	SaagharItemDelegate *searchDelegate = new SaagharItemDelegate(searchTable, searchTable->style(), phrase);
	searchTable->setItemDelegateForColumn(2, searchDelegate);
	connect(this, SIGNAL(searchFiltered(const QString &)), searchDelegate, SLOT(keywordChanged(const QString &)) );

	//searchTable->setItemDelegateForColumn(2, new SaagharItemDelegate(searchTable, searchTable->style(), phrase));

	searchTableGridLayout->addWidget(searchTable, 0, 0, 1, 1);

//	QVBoxLayout *searchNavVerticalLayout = new QVBoxLayout();
//	searchNavVerticalLayout->setSpacing(6);
//	searchNavVerticalLayout->setObjectName(QString::fromUtf8("searchNavVerticalLayout"));

	searchNextPage = new QToolButton(searchResultContents);
	searchNextPage->setObjectName(QString::fromUtf8("searchNextPage"));
	searchNextPage->setStyleSheet("QToolButton { border: none; padding: 0px; }");

	actSearchNextPage = new QAction(searchResultContents);
	searchNextPage->setDefaultAction(actSearchNextPage);

	connect(searchNextPage, SIGNAL(triggered(QAction *)), this, SLOT(searchPageNavigationClicked(QAction *)));

	searchNextPage->setEnabled(false);
	searchNextPage->hide();
	
	//searchNavVerticalLayout->addWidget(searchNextPage);

	searchPreviousPage = new QToolButton(searchResultContents);
	searchPreviousPage->setObjectName(QString::fromUtf8("searchPreviousPage"));
	searchPreviousPage->setStyleSheet("QToolButton { border: none; padding: 0px; }");
	
	actSearchPreviousPage = new QAction(searchResultContents);
	searchPreviousPage->setDefaultAction(actSearchPreviousPage);

	if (qmw->layoutDirection() == Qt::LeftToRight)
	{
		actSearchPreviousPage->setIcon(QIcon(iconThemePath+"/previous.png"));
		actSearchNextPage->setIcon(QIcon(iconThemePath+"/next.png"));
	}
	else
	{
		actSearchPreviousPage->setIcon(QIcon(iconThemePath+"/next.png"));
		actSearchNextPage->setIcon(QIcon(iconThemePath+"/previous.png"));
	}

	connect(searchPreviousPage, SIGNAL(triggered(QAction *)), this, SLOT(searchPageNavigationClicked(QAction *)));

	searchPreviousPage->setEnabled(false);
	searchPreviousPage->hide();

//	searchNavVerticalLayout->addWidget(searchPreviousPage);

	//QSpacerItem *searchNavVerticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);

	//searchNavVerticalLayout->addItem(searchNavVerticalSpacer);

//	if (moreThanOnePage)
//		horizontalLayout->addLayout(searchNavVerticalLayout);

	filterHorizontalLayout->addWidget(searchPreviousPage);
	filterHorizontalLayout->addWidget(searchNextPage);
	filterHorizontalLayout->addWidget(pageLabel, 0, Qt::AlignRight|Qt::AlignCenter);
	searchTableGridLayout->addLayout(filterHorizontalLayout, 1, 0, 1, 1);

	horizontalLayout->addLayout(searchTableGridLayout);

	searchGridLayout->addLayout(horizontalLayout, 0, 0, 1, 1);

/****************************/
	QDockWidget *tmpDockWidget = 0;
	QObjectList mainWindowChildren = qmw->children();
	for (int i=0; i < mainWindowChildren.size(); ++i)
	{
		tmpDockWidget = qobject_cast<QDockWidget *>(mainWindowChildren.at(i));
		if (tmpDockWidget)
		{
			if (mainWindowChildren.at(i)->objectName() == "searchResultWidget_old")
			break;
		}
	}

/****************************************/
	searchResultWidget->setWidget(searchResultContents);
	
	qmw->addDockWidget(Qt::LeftDockWidgetArea, searchResultWidget);
	
	if (tmpDockWidget && tmpDockWidget->objectName() == "searchResultWidget_old") //there is another search results dock-widget present
		qmw->tabifyDockWidget(tmpDockWidget, searchResultWidget);

	
	searchResultWidget->setObjectName("searchResultWidget_old");

	searchResultWidget->show();
	searchResultWidget->raise();
}
Esempio n. 10
0
QDockWidget* MainWindow::createDockWidget(KoDockFactoryBase* factory)
{
    QDockWidget* dockWidget = 0;

    if(!m_dockWidgetMap.contains(factory->id())) {
        dockWidget = factory->createDockWidget();

        // It is quite possible that a dock factory cannot create the dock; don't
        // do anything in that case.
        if(!dockWidget) return 0;
        m_dockWidgets.push_back(dockWidget);

        dockWidget->setObjectName(factory->id());
        dockWidget->setParent(this);

        if(dockWidget->widget() && dockWidget->widget()->layout())
            dockWidget->widget()->layout()->setContentsMargins(1, 1, 1, 1);

        Qt::DockWidgetArea side = Qt::RightDockWidgetArea;
        bool visible = true;

        switch(factory->defaultDockPosition()) {
        case KoDockFactoryBase::DockTornOff:
            dockWidget->setFloating(true); // position nicely?
            break;
        case KoDockFactoryBase::DockTop:
            side = Qt::TopDockWidgetArea; break;
        case KoDockFactoryBase::DockLeft:
            side = Qt::LeftDockWidgetArea; break;
        case KoDockFactoryBase::DockBottom:
            side = Qt::BottomDockWidgetArea; break;
        case KoDockFactoryBase::DockRight:
            side = Qt::RightDockWidgetArea; break;
        case KoDockFactoryBase::DockMinimized:
            visible = false; break;
        default:;
        }

        addDockWidget(side, dockWidget);
        if(dockWidget->features() & QDockWidget::DockWidgetClosable) {
            m_dockWidgetMenu->addAction(dockWidget->toggleViewAction());
            if(!visible)
                dockWidget->hide();
        }

        m_dockWidgetMap.insert(factory->id(), dockWidget);
    } else {
        dockWidget = m_dockWidgetMap[ factory->id()];
    }

    KConfigGroup group(KSharedConfig::openConfig(), "GUI");
    QFont dockWidgetFont  = QFontDatabase::systemFont(QFontDatabase::GeneralFont);
    qreal pointSize = group.readEntry("palettefontsize", dockWidgetFont.pointSize() * 0.75);
    pointSize = qMax(pointSize, QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont).pointSizeF());
    dockWidgetFont.setPointSizeF(pointSize);
#ifdef Q_WS_MAC
    dockWidget->setAttribute(Qt::WA_MacSmallSize, true);
#endif
    dockWidget->setFont(dockWidgetFont);

    connect(dockWidget, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(forceDockTabFonts()));

    return dockWidget;
}