Visual Studio中特定于Qt的构造的缩进缩进 [英] Broken indentation for Qt-specific constructions in Visual Studio
问题描述
VS编辑器中的自动缩进显然不了解Qt.信号和插槽的声明是这样自动格式化的:
Automatic indentation in VS editor obviously does not know about Qt. And declarations of signals and slots are auto-formatted like this:
class MyClass : public QObject
{
Q_OBJECT
public:
MyClass();
signals: // <-- Broken indentation
void someSignal();
public slots: // <-- Also broken
void someSlot();
};
我希望信号:"和插槽:"自动格式化,就像访问说明符一样.有什么选择? (我正在使用VS2010)
I want "signals:" and "slots:" automatically formatted just like access specifiers. What are the options? (I'm using VS2010)
推荐答案
简而言之,似乎没有.也许不是您要找的东西,但也许可以忍受:
In short answer seems to be NO. Maybe not what you are looking for but maybe you can live with this:
class MyClass : public QObject
{
Q_OBJECT
public:
MyClass();
private:
Q_SIGNAL void someSignal();
public:
Q_SLOT void someSlot();
};
(这很丑,但看来你也不能吃蛋糕;)
(It's ugly but it seems you can't have your cake and eat it too ;)
我只是想知道一点:为自动格式化构建插件值得吗?我们真的使用了CTRL-A CTRL-F吗?如果是这样,那么可能会很痛苦.但是通常情况下,如果您正在处理头文件,则声明新方法(信号或插槽)不应弄乱先前更正的缩进.也许您有一些理由证明这一点?
Just something I'm wondering about: Is it worth the effort to build a plugin for automatic formatting? Do we really use CTRL-A CTRL-F so much? If so, then yes it could be a pain. But normally if you are working on header files declaring a new method (signal or slot) should not mess up the previous corrected indentation. Perhaps you have some reasons that justifies this?
这篇关于Visual Studio中特定于Qt的构造的缩进缩进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!