minor tweaks

This commit is contained in:
Garux
2025-09-03 00:29:13 +05:00
parent 5d7789438e
commit 911a7cceeb
98 changed files with 594 additions and 598 deletions
+33 -33
View File
@@ -244,7 +244,7 @@ public:
m_key( key ),
m_entry( new NonModalEntry( ApplyCaller( *this ), UpdateCaller( *this ) ) ){
m_entry->setValidator( new KeyValueValidator( m_entry ) );
auto button = m_entry->addAction( QApplication::style()->standardIcon( QStyle::SP_ArrowRight ), QLineEdit::ActionPosition::TrailingPosition );
auto *button = m_entry->addAction( QApplication::style()->standardIcon( QStyle::SP_ArrowRight ), QLineEdit::ActionPosition::TrailingPosition );
QObject::connect( button, &QAction::triggered, [this](){ browse(); } );
}
void release() override {
@@ -283,7 +283,7 @@ public:
m_key( key ),
m_entry( new NonModalEntry( ApplyCaller( *this ), UpdateCaller( *this ) ) ){
m_entry->setValidator( new KeyValueValidator( m_entry ) );
auto button = m_entry->addAction( QApplication::style()->standardIcon( QStyle::SP_DialogOpenButton ), QLineEdit::ActionPosition::TrailingPosition );
auto *button = m_entry->addAction( QApplication::style()->standardIcon( QStyle::SP_DialogOpenButton ), QLineEdit::ActionPosition::TrailingPosition );
QObject::connect( button, &QAction::triggered, [this](){ browse(); } );
}
void release() override {
@@ -347,7 +347,7 @@ public:
m_key( key ),
m_entry( new NonModalEntry( ApplyCaller( *this ), UpdateCaller( *this ) ) ){
m_entry->setValidator( new KeyValueValidator( m_entry ) );
auto button = m_entry->addAction( QApplication::style()->standardIcon( QStyle::SP_MediaVolume ), QLineEdit::ActionPosition::TrailingPosition );
auto *button = m_entry->addAction( QApplication::style()->standardIcon( QStyle::SP_MediaVolume ), QLineEdit::ActionPosition::TrailingPosition );
QObject::connect( button, &QAction::triggered, [this](){ browse(); } );
}
void release() override {
@@ -396,8 +396,8 @@ public:
};
inline QWidget *new_container_widget(){
QWidget *w = new QWidget;
auto l = new QHBoxLayout( w );
auto *w = new QWidget;
auto *l = new QHBoxLayout( w );
l->setContentsMargins( 0, 0, 0, 0 );
return w;
}
@@ -823,7 +823,7 @@ public:
EntityClassListStoreAppend( QTreeWidget* tree_ ) : tree( tree_ ){
}
void visit( EntityClass* e ) override {
auto item = new QTreeWidgetItem( tree );
auto *item = new QTreeWidgetItem( tree );
item->setData( 0, Qt::ItemDataRole::DisplayRole, e->name() );
item->setData( 0, Qt::ItemDataRole::UserRole, QVariant::fromValue( e ) );
}
@@ -919,7 +919,7 @@ void EntityClassList_selectEntityClass( EntityClass* eclass ){
void EntityInspector_appendAttribute( const EntityClassAttributePair& attributePair, EntityAttribute& attribute ){
const char* keyname = attributePair.first.c_str(); //EntityClassAttributePair_getName( attributePair );
auto label = new QLabel( keyname );
auto *label = new QLabel( keyname );
EntityAttribute_setTooltip( label, attributePair.second.m_name.c_str(), attributePair.second.m_description.c_str() );
DialogGrid_packRow( g_attributeBox, attribute.getWidget(), label );
}
@@ -1103,7 +1103,7 @@ void EntityInspector_applyKeyValue(){
void EntityInspector_clearKeyValue(){
// Get current selection text
if( const auto item = g_entprops_store->currentItem() ){
if( const auto *item = g_entprops_store->currentItem() ){
const auto key = item->text( 0 ).toLatin1();
if ( !string_equal( key.constData(), "classname" ) ) {
@@ -1119,7 +1119,7 @@ class : public QObject
protected:
bool eventFilter( QObject *obj, QEvent *event ) override {
if( event->type() == QEvent::ShortcutOverride ) {
QKeyEvent *keyEvent = static_cast<QKeyEvent *>( event );
auto *keyEvent = static_cast<QKeyEvent *>( event );
if( keyEvent->key() == Qt::Key_Delete ){
EntityInspector_clearKeyValue();
event->accept();
@@ -1164,7 +1164,7 @@ class : public QObject
protected:
bool eventFilter( QObject *obj, QEvent *event ) override {
if( event->type() == QEvent::ShortcutOverride ) {
QKeyEvent *keyEvent = static_cast<QKeyEvent *>( event );
auto *keyEvent = static_cast<QKeyEvent *>( event );
if( keyEvent->key() == Qt::Key_Return
|| keyEvent->key() == Qt::Key_Enter
|| keyEvent->key() == Qt::Key_Tab
@@ -1194,14 +1194,14 @@ void EntityInspector_destroyWindow(){
}
QWidget* EntityInspector_constructWindow( QWidget* toplevel ){
auto splitter = new QSplitter( Qt::Vertical );
auto *splitter = new QSplitter( Qt::Vertical );
QObject::connect( splitter, &QObject::destroyed, EntityInspector_destroyWindow );
splitter->installEventFilter( &g_pressedKeysFilter );
{
// class list
auto tree = g_entityClassList = new QTreeWidget;
auto *tree = g_entityClassList = new QTreeWidget;
tree->setColumnCount( 1 );
tree->setSortingEnabled( true );
tree->sortByColumn( 0, Qt::SortOrder::AscendingOrder );
@@ -1223,25 +1223,25 @@ QWidget* EntityInspector_constructWindow( QWidget* toplevel ){
splitter->addWidget( tree );
}
{
auto text = g_entityClassComment = new QPlainTextEdit;
auto *text = g_entityClassComment = new QPlainTextEdit;
text->setReadOnly( true );
text->setUndoRedoEnabled( false );
splitter->addWidget( text );
}
{
QWidget *containerWidget = new QWidget; // Adding a QLayout to a QSplitter is not supported, use proxy widget
auto *containerWidget = new QWidget; // Adding a QLayout to a QSplitter is not supported, use proxy widget
splitter->addWidget( containerWidget );
auto vbox = new QVBoxLayout( containerWidget );
auto *vbox = new QVBoxLayout( containerWidget );
vbox->setContentsMargins( 0, 0, 0, 0 );
{
// Spawnflags (4 colums wide max, or window gets too wide.)
auto grid = g_spawnflagsTable = new QGridLayout;
auto *grid = g_spawnflagsTable = new QGridLayout;
grid->setAlignment( Qt::AlignmentFlag::AlignLeft );
vbox->addLayout( grid );
for ( int i = 0; i < MAX_FLAGS; i++ )
{
auto check = g_entitySpawnflagsCheck[i] = new QCheckBox;
auto *check = g_entitySpawnflagsCheck[i] = new QCheckBox;
grid->addWidget( check, i / 4, i % 4 );
check->hide();
QObject::connect( check, &QAbstractButton::clicked, EntityInspector_applySpawnflags );
@@ -1249,7 +1249,7 @@ QWidget* EntityInspector_constructWindow( QWidget* toplevel ){
}
{
// key/value list
auto tree = g_entprops_store = new QTreeWidget;
auto *tree = g_entprops_store = new QTreeWidget;
tree->setColumnCount( 2 );
tree->setUniformRowHeights( true ); // optimization
tree->setHorizontalScrollBarPolicy( Qt::ScrollBarPolicy::ScrollBarAlwaysOff );
@@ -1266,7 +1266,7 @@ QWidget* EntityInspector_constructWindow( QWidget* toplevel ){
{
// key/value entry
auto grid = new QGridLayout;
auto *grid = new QGridLayout;
grid->setContentsMargins( 4, 0, 4, 0 );
vbox->addLayout( grid );
{
@@ -1274,21 +1274,21 @@ QWidget* EntityInspector_constructWindow( QWidget* toplevel ){
grid->addWidget( new QLabel( "Value" ), 1, 0 );
}
{
auto line = g_entityKeyEntry = new LineEdit;
auto *line = g_entityKeyEntry = new LineEdit;
grid->addWidget( line, 0, 1 );
QObject::connect( line, &QLineEdit::returnPressed, [](){ g_entityValueEntry->setFocus(); g_entityValueEntry->selectAll(); } );
line->setValidator( new KeyNameValidator( line ) );
}
{
auto line = g_entityValueEntry = new LineEdit;
auto *line = g_entityValueEntry = new LineEdit;
grid->addWidget( line, 1, 1 );
QObject::connect( line, &QLineEdit::returnPressed, [](){ EntityInspector_applyKeyValue(); } );
line->setValidator( new KeyValueValidator( line ) );
}
/* select by key/value buttons */
{
auto b = new QToolButton;
auto *b = new QToolButton;
b->setText( "+" );
b->setToolTip( "Select by key" );
grid->addWidget( b, 0, 2 );
@@ -1297,7 +1297,7 @@ QWidget* EntityInspector_constructWindow( QWidget* toplevel ){
} );
}
{
auto b = new QToolButton;
auto *b = new QToolButton;
b->setText( "+" );
b->setToolTip( "Select by value" );
grid->addWidget( b, 1, 2 );
@@ -1306,7 +1306,7 @@ QWidget* EntityInspector_constructWindow( QWidget* toplevel ){
} );
}
{
auto b = new QToolButton;
auto *b = new QToolButton;
b->setText( "+" );
b->setToolTip( "Select by key + value" );
grid->addWidget( b, 0, 3, 2, 1 );
@@ -1316,42 +1316,42 @@ QWidget* EntityInspector_constructWindow( QWidget* toplevel ){
}
}
{
auto hbox = new QHBoxLayout;
auto *hbox = new QHBoxLayout;
hbox->setContentsMargins( 4, 0, 4, 0 );
vbox->addLayout( hbox );
{
auto b = new QPushButton( "Clear All" );
auto *b = new QPushButton( "Clear All" );
hbox->addWidget( b );
QObject::connect( b, &QAbstractButton::clicked, EntityInspector_clearAllKeyValues );
}
{
auto b = new QPushButton( "Delete Key" );
auto *b = new QPushButton( "Delete Key" );
hbox->addWidget( b );
QObject::connect( b, &QAbstractButton::clicked, EntityInspector_clearKeyValue );
}
{
auto b = new QToolButton;
auto *b = new QToolButton;
hbox->addWidget( b );
b->setText( "<" );
b->setToolTip( "Select targeting entities" );
QObject::connect( b, &QAbstractButton::clicked, [](){ Select_ConnectedEntities( true, false, g_focusToggleButton->isChecked() ); } );
}
{
auto b = new QToolButton;
auto *b = new QToolButton;
hbox->addWidget( b );
b->setText( ">" );
b->setToolTip( "Select targets" );
QObject::connect( b, &QAbstractButton::clicked, [](){ Select_ConnectedEntities( false, true, g_focusToggleButton->isChecked() ); } );
}
{
auto b = new QToolButton;
auto *b = new QToolButton;
hbox->addWidget( b );
b->setText( "<->" );
b->setToolTip( "Select connected entities" );
QObject::connect( b, &QAbstractButton::clicked, [](){ Select_ConnectedEntities( true, true, g_focusToggleButton->isChecked() ); } );
}
{
auto b = g_focusToggleButton = new QToolButton;
auto *b = g_focusToggleButton = new QToolButton;
hbox->addWidget( b );
b->setText( "👀" );
b->setToolTip( "AutoFocus on Selection" );
@@ -1361,12 +1361,12 @@ QWidget* EntityInspector_constructWindow( QWidget* toplevel ){
}
}
{
auto scroll = new QScrollArea;
auto *scroll = new QScrollArea;
scroll->setHorizontalScrollBarPolicy( Qt::ScrollBarPolicy::ScrollBarAlwaysOff );
scroll->setWidgetResizable( true );
splitter->addWidget( scroll );
QWidget *containerWidget = new QWidget; // Adding a QLayout to a QScrollArea is not supported, use proxy widget
auto *containerWidget = new QWidget; // Adding a QLayout to a QScrollArea is not supported, use proxy widget
g_attributeBox = new QGridLayout( containerWidget );
g_attributeBox->setAlignment( Qt::AlignmentFlag::AlignTop );
g_attributeBox->setColumnStretch( 0, 111 );