void EditorPage::setTabWidth(uint nTabWidth)
{
	KTextEditor::CommandInterface *pCmdIf;
	KTextEditor::Command *pKateCmd;
	QString sCmd, sResult;

	pCmdIf = qobject_cast<KTextEditor::CommandInterface *>(KTextEditor::EditorChooser::editor());
	if ( pCmdIf && (pKateCmd = pCmdIf->queryCommand("set-tab-width"))) {
		sCmd.sprintf("set-tab-width %u", nTabWidth);
		pKateCmd->exec(m_pView, sCmd, sResult);
	}
}
Exemple #2
0
// set Tab charactor's width (4 / 8 or else)
void EditorPage::setTabWidth(uint nTabWidth)
{
    KTextEditor::Editor *editor = m_pDoc->editor();
    KTextEditor::CommandInterface *iface = 
        qobject_cast<KTextEditor::CommandInterface *>(editor);

	QString sCmd, sResult;
    const QString cmd("set-tab-width");
    KTextEditor::Command *pCmd = iface->queryCommand(cmd);

    if (pCmd) {
		sCmd.sprintf("set-tab-width %u", nTabWidth);
		if (pCmd->exec(m_pView, sCmd, sResult) == false) {
            qDebug("set tab width failed: %s", sResult.toAscii().data());
        }
    } else {
        qDebug("no this cmd");
    }
}