示例#1
0
SCgMainWindow::SCgMainWindow(QObject *parent) :
    QObject(parent),
    mView(0),
    mScene(0),
    mInputHandler(0)
{
    mView = new SCgView();
    mInputHandler = new SCgMainWindowInputHandler(mView);
    mScene = new SCgMainWindowScene(mInputHandler, mView);

    mView->setCacheMode(QGraphicsView::CacheBackground);//CacheBackground);
    mView->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
    mView->setRenderHint(QPainter::Antialiasing);
    mView->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
    mView->setResizeAnchor(QGraphicsView::AnchorViewCenter);
    mView->setOptimizationFlag(QGraphicsView::DontAdjustForAntialiasing);
    mView->setDragMode(QGraphicsView::RubberBandDrag);
    mView->setAcceptDrops(true);
    mView->setSceneRect(-1024, -1024, 2048, 2048);

    mView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    mView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

//    mView->setViewport(new QGLWidget());
//    mView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);

    mView->setScene(mScene);

    initializeActions();

    mView->show();
}
MdiContainerWidgetTaskMenu::MdiContainerWidgetTaskMenu(QMdiArea *m, QObject *parent) :
    ContainerWidgetTaskMenu(m, MdiContainer, parent)
{
    initializeActions();
    connect(m_nextAction, SIGNAL(triggered()), m, SLOT(activateNextSubWindow()));
    connect(m_previousAction, SIGNAL(triggered()), m , SLOT(activatePreviousSubWindow()));
    connect(m_tileAction, SIGNAL(triggered()), m, SLOT(tileSubWindows()));
    connect(m_cascadeAction, SIGNAL(triggered()), m, SLOT(cascadeSubWindows()));
}
示例#3
0
PlayerController::PlayerController()
{
    // Default keybindings
    mKeyBinding[sf::Keyboard::Left] = MoveLeft;
    mKeyBinding[sf::Keyboard::Right] = MoveRight;
    mKeyBinding[sf::Keyboard::Space] = Attack;

    // initialize actions
    initializeActions();
}
示例#4
0
文件: KivioView.cpp 项目: KDE/koffice
KivioView::KivioView(KivioDocument* document, QWidget* parent)
  : KoPAView(document, parent), m_document(document)
{
    Q_ASSERT(m_document);

    setXMLFile("kivio.rc");

    initializeActions();
    initializeGUI();

    connect(m_document, SIGNAL(updateGui()), this, SLOT(updateGui()));
}
RKCommandEditorWindowPart::RKCommandEditorWindowPart (QWidget *parent, RKCommandEditorWindow *editor_widget) : KParts::Part (parent) {
	RK_TRACE (COMMANDEDITOR);

	KInstance* instance = new KInstance ("rkward");
	setInstance (instance);
 
	command_editor = editor_widget;

	setXMLFile ("rkcommandeditorwindowpart.rc");

	initializeActions ();
}
示例#6
0
文件: Player.cpp 项目: MVPet/JA
Player::Player()
{
	// Set initial key bindings
	mKeyBinding[sf::Keyboard::Left] = MoveLeft;
	mKeyBinding[sf::Keyboard::Right] = MoveRight;
	mKeyBinding[sf::Keyboard::Up] = MoveUp;
	mKeyBinding[sf::Keyboard::Down] = MoveDown;

	// Set initial action bindings
	initializeActions();

	// Assign all categories to player's aircraft
	for(auto& pair : mActionBinding)
		pair.second.category = Category::Player;
}
示例#7
0
Club::Club(Stadium *s, int _id, bool _goal)
{
	stadium = s;
	onTheRightGoal = _goal;

	sinceBallIsPassed = 0;
	someoneGettingBall = false;

	SquadPosition* sqp;
	for (int i=0; i<11; i++)
	{
		sqp = new SquadPosition;
		lineUp[i] = sqp;
	}
	
	for (int i=0; i<12; i++)
	{
		sqp = new SquadPosition;
		subs[i] = sqp;
	}	

	for (int i=0; i<12; i++)
	{
		sqp = new SquadPosition;
		reserves[i] = sqp;
	}

	switch(_id)
	{
	case ID_LEICESTER16:
		init_c_leicester16();
		break;
	case ID_MANUNITED16:
		init_c_manunited16();
		break;
	default:
		cout << "Error at club initialization. Wrong ID." << endl;
	}

	sortLineUp();
	assignClubs();
	initializeActions();
}
示例#8
0
void WebView::setPage(WebPage *page)
{
    if (m_page == page) {
        return;
    }

    QWebEngineView::setPage(page);
    m_page = qobject_cast<WebPage*>(page);

    connect(m_page, SIGNAL(privacyChanged(bool)), this, SIGNAL(privacyChanged(bool)));

    // Set default zoom level
    zoomReset();

    // Actions needs to be initialized for every QWebPage change
    initializeActions();

    mApp->plugins()->emitWebPageCreated(m_page);
}
示例#9
0
void ImageNavigator::initialize() {
    setWindowFlags(Qt::Window | windowFlags());
    setAttribute(Qt::WA_DeleteOnClose);

    QRect screenRect = QApplication::desktop()->screenGeometry(QApplication::desktop()->primaryScreen());
    screenWidth = screenRect.width();
    screenHeight = screenRect.height();
    // qDebug() << "Screen Dimensions are " << screenWidth << " x " << screenHeight << endl;

    initializeTools();
    initializeActions();

    setBackgroundRole(QPalette::Dark);
    setForegroundRole(QPalette::Dark);
    navOrigin = QPoint(0, 0);
    scrollSpeed = 150;
    scrollBorder = 100;
    horizontalScrollBar()->setRange(0, 200);
    verticalScrollBar()->setRange(0, 200);
    horScroll = 0;
    verScroll = 0;
    imageScale = 1.0;
    //  maximumValueSearchRange=10;
    //  sigma = 3.0;
    //  maxSearchMethod = mrcImage::maximum_value;

    spotSelectMode = false;
    latticeRefinementMode = false;
    createPathMode = false;
    ctfView = false;
    viewDisplayParameters = false;
    fftSelectionMode = false;
    viewport()->setMouseTracking(true);
    connect(menu, SIGNAL(aboutToShow()), this, SLOT(openMenu()));

    if (imageType != "fft")
        image->setVisible("realOverlay", true);

    resize(1024, 768);
    showMaximized();
    //showFullScreen();
}
示例#10
0
GLShaderDev::GLShaderDev(const QStringList& args)
:   _editor(new CodeEditor(this)),
    _output(new BuildOutput(this)),
    _glInfoDialog(nullptr),
    _newFileDialog(new NewFileDialog(this))
{
    resize(1000, 800); // FIXME set sizeHint instead of hardcoding it
    setWindowIcon(QIcon(":/glsd-icon.png"));
    setCentralWidget(_editor);

    initializeContext();
    initializeActions();
    initializeDockWidgets();

    loadSettings();
    updateTitleBar();

    for (int i = 0; i < args.size(); ++i)
        openFile(args.at(i));
}
示例#11
0
Player::Player():
    m_currentLevel("level_1.tmx"),
    m_currentGameStatus(LevelRunning)
{
        // Set initial key bindings
        m_keyBinding[sf::Keyboard::Z] = GoForward;
        m_keyBinding[sf::Keyboard::S] = GoBackward;
        m_keyBinding[sf::Keyboard::Q] = TurnLeft;
        m_keyBinding[sf::Keyboard::D] = TurnRight;
        m_keyBinding[sf::Keyboard::R] = SetRed;
        m_keyBinding[sf::Keyboard::G] = SetGreen;
        m_keyBinding[sf::Keyboard::B] = SetBlue;

        // Set initial action bindings
        initializeActions();

        for (auto it = m_actionBinding.begin(); it!= m_actionBinding.end(); ++it)
            (*it).second.category = Category::PlayerActor;

}
示例#12
0
void LogBook::init()
{
	qDebug() << "LogBook plugin - press Command-L to toggle Log Book view mode. Press ALT-L for configuration.";
	initializeDatabase();
	//Load the module's custom style sheets
	QFile styleSheetFile;
	styleSheetFile.setFileName(":/logbook/normalStyle.css");
	if(styleSheetFile.open(QFile::ReadOnly|QFile::Text)){
		normalStyleSheet = styleSheetFile.readAll();
	}
	styleSheetFile.close();
	styleSheetFile.setFileName(":/logbook/nightStyle.css");
	if(styleSheetFile.open(QFile::ReadOnly|QFile::Text)){
		nightStyleSheet = styleSheetFile.readAll();
	}
	styleSheetFile.close();

	configDialog = new LogBookConfigDialog(tableModels);
	sessionsDialog = new SessionsDialog(tableModels);
	targetsDialog = new TargetsDialog(tableModels);
	flagShowLogBook = false;
	initializeActions();
}
示例#13
0
RKConsole::RKConsole (QWidget *parent, bool tool_window, const char *name) : RKMDIWindow (parent, RKMDIWindow::ConsoleWindow, tool_window, name) {
	RK_TRACE (APP);

	QVBoxLayout *layout = new QVBoxLayout (this);
	layout->setContentsMargins (0, 0, 0, 0);

	// create a Kate-part as command-editor
	KTextEditor::Editor* editor = KTextEditor::editor("katepart");
	RK_ASSERT (editor);

	doc = editor->createDocument (this);
	view = doc->createView (this);
	layout->addWidget (view);

	KTextEditor::ConfigInterface *confint = qobject_cast<KTextEditor::ConfigInterface*> (view);
	RK_ASSERT (view);
	confint->setConfigValue ("dynamic-word-wrap", false);

	setFocusProxy (view);
	setFocusPolicy (Qt::StrongFocus);
	
	/* We need to disable kactions that were plugged to the KateViewInternal in kateview.cpp.
	These actions include Key_Up, Key_Down, etc. */
	kate_edit_actions = view->findChild<KActionCollection*> ("edit_actions");
	if (!kate_edit_actions) {
		kate_edit_actions=view->actionCollection();
	}
	if (kate_edit_actions) {
		// make sure these actions never get triggered by a shortcut

		QList<QKeySequence> noshort;
		noshort.append (QKeySequence ());	// no primary
		noshort.append (QKeySequence ());	// no secondary
		noshort.append (QKeySequence ());	// for good measure

		QList<QAction*> keas = kate_edit_actions->actions ();
		for (int i = 0; i < keas.size (); ++i) {
			keas[i]->setShortcuts (noshort);
		}
	} else {
		RK_DO (qDebug ("Could not retrieve the katepart's edit action collection"), APP, DL_ERROR);
	}

	if (view->focusProxy ()) view->focusProxy()->installEventFilter(this);
	view->installEventFilter(this);

	doc->setModified (false);

	hinter = new RKFunctionArgHinter (this, view);
	
	setCaption (i18n ("R Console"));
	console_part = new RKConsolePart (this);
	setPart (console_part);
	setMetaInfo (shortCaption (), "rkward://page/rkward_console", RKSettings::PageConsole);
	initializeActivationSignals ();
	initializeActions (getPart ()->actionCollection ());

	nprefix = "> ";
	iprefix = "+ ";
	prefix = nprefix;
// KDE4: a way to do this?
//	doc->setUndoSteps (0);
	clear ();
	RKCommandHighlighter::setHighlighting (doc, RKCommandHighlighter::RInteractiveSession);

	commands_history = RKSettingsModuleConsole::loadCommandHistory ();
	commands_history_position = commands_history.constEnd ();

	current_command = 0;
	current_command_displayed_up_to = 0;
	tab_key_pressed_before = false;
	previous_chunk_was_piped = false;

// KDE4 TODO: workaround for KDE 4 pre-release versions. Hope this gets fixed before 4.0
// see http://lists.kde.org/?l=kwrite-devel&m=119721420603507&w=2
	setMinimumHeight (50);
}
示例#14
0
RKConsole::RKConsole () : QWidget (0) {
	RK_TRACE (APP);

	QVBoxLayout *layout = new QVBoxLayout (this);

	// create a Kate-part as command-editor
#if !KDE_IS_VERSION (3, 2, 0)
	doc = static_cast<Kate::Document *> (KTextEditor::createDocument ("libkatepart", this, "Kate::Document"));
	view = static_cast<Kate::View *> (doc->createView (this));
# else
	doc = Kate::document (KTextEditor::createDocument ("libkatepart", this, "Kate::Document"));
	RK_ASSERT (doc);
	view = Kate::view (doc->createView (this));
	RK_ASSERT (view);
#endif
	layout->addWidget (view);

	view->setDynWordWrap (false);

	setFocusProxy (view);
	setFocusPolicy (QWidget::StrongFocus);
	
	/* We need to unplug kactions that were pluged to the KateViewInternal in kateview.cpp.
	These actions incluse Key_Up, Key_Down, etc.
	It's a bit boring to do, but there is no way to do that another way yet.
	Apparently, things will be different in KDE 4.*/
	const QObjectList *list = view->children ();
	QObjectListIt it (*list);
	QObject *obj;
	
	KActionCollection* ac=0;
	QWidget* Kvi=0; //here we store the KateViewInternal of the view, so we can uplug actions from it
	
	while ((obj = it.current()) != 0) {
		++it;
		obj->installEventFilter (this);
		if (obj->inherits("KActionCollection")) {
			ac= (KActionCollection*) obj;
		} else if(obj->inherits("KateViewInternal")) {
			Kvi= (QWidget*) obj;
		}
	}

	if (ac) {
		unplugAction("move_line_up", ac);
		unplugAction("move_line_down", ac);
		unplugAction("move_cusor_left", ac);
		unplugAction("beginning_of_line", ac);
		unplugAction("backspace", ac);
		unplugAction("delete_next_character", ac);
		unplugAction("beginning_of_document", ac);
		unplugAction("select_beginning_of_line", ac);
		unplugAction("select_char_left", ac);
		unplugAction("word_left", ac); //TODO deal with that one
		unplugAction("select_word_left", ac); //TODO deal with that one
		unplugAction("select_beginning_of_document", ac);
		unplugAction("select_end_of_document", ac);
		unplugAction("select_line_up", ac);
		unplugAction("select_line_down", ac);
		unplugAction("select_page_up", ac);
		unplugAction("move_top_of_view", ac);
		unplugAction("select_top_of_view", ac);
		unplugAction("select_page_down", ac);
		unplugAction("move_bottom_of_view", ac);
		unplugAction("select_bottom_of_view", ac);
		unplugAction("to_matching_bracket", ac);
		unplugAction("select_matching_bracket", ac);
		unplugAction("paste", ac);
	} else {
		RK_DO (qDebug ("Could not retrieve the view's action collection"), APP, DL_WARNING);
	}

	view->focusProxy()->installEventFilter(this);
	view->installEventFilter(this);

	doc->setModified (false);

	hinter = new RKFunctionArgHinter (this, view);
	
	setCaption (i18n ("R Console"));
	part = new RKConsolePart (this);
	initializeActions (part->actionCollection ());

	nprefix = "> ";
	iprefix = "+ ";
	prefix = nprefix;
	command_incomplete = false;
	output_continuation = false;
	doc->setUndoSteps (0);
	clear ();
	setRHighlighting ();

	commands_history = RKSettingsModuleConsole::loadCommandHistory ();
	commands_history_position = commands_history.constEnd ();

	current_command = 0;
	tab_key_pressed_before = false;
}
示例#15
0
/**
*@brief Instancie les Qmenu et les QAction.
*/
void MainWindow::createMenuBar()
{
    initializeMenuItems();		// Creates all QMenu
    initializeActions();		// Creates and add all QAction to the menu
}