当前位置: 首页>>代码示例>>C++>>正文


C++ QDockWidget::move方法代码示例

本文整理汇总了C++中QDockWidget::move方法的典型用法代码示例。如果您正苦于以下问题:C++ QDockWidget::move方法的具体用法?C++ QDockWidget::move怎么用?C++ QDockWidget::move使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDockWidget的用法示例。


在下文中一共展示了QDockWidget::move方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QMainWindow

Window::Window () : QMainWindow (NULL) {
    try {
        viewer = new GLViewer;
    } catch (GLViewer::Exception e) {
        cerr << e.getMessage () << endl;
        exit (1);
    }
    setCentralWidget (viewer);

#if DEBUG
    cout << "/ ! \\ Building in Debug mode. Performance will be impacted" << endl;
#else
    viewer->setBaseSize(500, 500);
#endif
    
    initControlWidget ();
    
    QDockWidget * controlDockWidget = new QDockWidget (this);
    
    controlDockWidget->setWidget (controlWidget);
    controlDockWidget->adjustSize ();
    addDockWidget (Qt::RightDockWidgetArea, controlDockWidget);
    controlDockWidget->setFloating(true);
    controlDockWidget->setFeatures (QDockWidget::AllDockWidgetFeatures);
    controlDockWidget->adjustSize();
    controlDockWidget->move(0, 0);
    
    QDockWidget * focalDockWidget = new QDockWidget (this);
    focalDockWidget->setWidget(focalWidget);
    focalDockWidget->adjustSize ();
    addDockWidget (Qt::LeftDockWidgetArea, focalDockWidget);
    focalDockWidget->setFloating(true);
    focalDockWidget->setFeatures (QDockWidget::AllDockWidgetFeatures);
    focalDockWidget->adjustSize();
    focalDockWidget->move(200, 0);

    QDockWidget* rayTracerDockWidget = new QDockWidget(this);
    rayTracerDockWidget->setWidget(rayTracerWidget);
    rayTracerDockWidget->adjustSize ();
    addDockWidget (Qt::TopDockWidgetArea, rayTracerDockWidget);
    rayTracerDockWidget->setFloating(true);
    rayTracerDockWidget->setFeatures (QDockWidget::AllDockWidgetFeatures);
    rayTracerDockWidget->adjustSize();

    // Move widgets around the raytracer
    
    QDesktopWidget desktop;
    QRect mainScreenSize = desktop.availableGeometry(desktop.primaryScreen());
    
    controlDockWidget->move(mainScreenSize.width() - 200, 0);
    rayTracerDockWidget->move(0, 0);
    focalDockWidget->move(0, mainScreenSize.height() - focalDockWidget->height());
    
    statusBar()->showMessage("");
}
开发者ID:jcaille,项目名称:Raymini,代码行数:55,代码来源:Window.cpp

示例2: loadFile

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;
}
开发者ID:SashaIliyn,项目名称:GUI-Project,代码行数:92,代码来源:MainWindowImpl.cpp


注:本文中的QDockWidget::move方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。