本文整理汇总了C++中ktexteditor::View::sizePolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ View::sizePolicy方法的具体用法?C++ View::sizePolicy怎么用?C++ View::sizePolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ktexteditor::View
的用法示例。
在下文中一共展示了View::sizePolicy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connect
void
FileManager::showInEditor(const KURL& url)
{
for (std::list<ManagedFileInfo*>::iterator mfi = files.begin();
mfi != files.end(); ++mfi)
if ((*mfi)->getFileURL() == url)
{
if (!(*mfi)->getEditor())
{
// The file has not yet been loaded, so we create an editor for
// it.
KTextEditor::Document* document;
if (!(document = KTextEditor::EditorChooser::createDocument
(viewStack, "KTextEditor::Document", "Editor")))
{
KMessageBox::error
(viewStack,
i18n("A KDE text-editor component could not "
"be found; please check your KDE "
"installation."));
return;
}
if (!editorConfigured)
{
if (!KTextEditor::configInterface(document))
{
KMessageBox::error
(viewStack,
i18n("You have selected a KDE Editor component "
"that is not powerful enough for "
"TaskJuggler. "
"Please select the 'Embedded Advanced Text "
"Editor' component in the KDE Control "
"Panel."));
return;
}
KTextEditor::configInterface(document)->readConfig(config);
editorConfigured = true;
}
KTextEditor::View* editor =
document->createView(viewStack);
viewStack->addWidget(editor);
(*mfi)->setEditor(editor);
editor->setMinimumSize(400, 200);
editor->setSizePolicy(QSizePolicy(QSizePolicy::Maximum,
QSizePolicy::Maximum, 0, 85,
editor->sizePolicy()
.hasHeightForWidth()));
document->openURL(url);
document->setReadWrite(true);
document->setModified(false);
// Signal to update the file-modified status
connect(document, SIGNAL(textChanged()),
*mfi, SLOT(setModified()));
connect(document,
SIGNAL(modifiedOnDisc(Kate::Document*, bool,
unsigned char)),
*mfi,
SLOT(setModifiedOnDisc(Kate::Document*, bool,
unsigned char)));
/* Remove some actions of the editor that we don't want to
* show in the menu/toolbars */
KActionCollection* ac = editor->actionCollection();
if (ac->action("file_print"))
ac->remove(ac->action("file_print"));
if (ac->action("view_folding_markers"))
ac->action("view_folding_markers")->
setShortcut(KShortcut());
if (ac->action("view_border"))
ac->action("view_border")->setShortcut(KShortcut());
if (ac->action("view_line_numbers"))
ac->action("view_line_numbers")->setShortcut(KShortcut());
if (ac->action("view_dynamic_word_wrap"))
ac->action("view_dynamic_word_wrap")->
setShortcut(KShortcut());
/* KActionPtrList actionList =
editor->actionCollection()->actions();
for (KActionPtrList::iterator it = actionList.begin();
it != actionList.end(); ++it)
{
printf("** Action found: %s\n", (*it)->name());
}*/
}
viewStack->raiseWidget((*mfi)->getEditor());
browser->clearSelection();
QListViewItem* lvi = (*mfi)->getBrowserEntry();
if (lvi)
{
browser->setCurrentItem(lvi);
lvi->setSelected(true);
}
break;
}