Skip to content

Commit

Permalink
Object creator can read spells (CleverRaven#58406)
Browse files Browse the repository at this point in the history
  • Loading branch information
snipercup authored Jun 27, 2022
1 parent 27817a3 commit ba775d7
Show file tree
Hide file tree
Showing 4 changed files with 361 additions and 22 deletions.
30 changes: 30 additions & 0 deletions object_creator/dual_list_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ void creator::dual_list_box::include_selected()
}
excluded_box.clear();
excluded_box.addItems( excluded );
if ( excluded.isEmpty() ) {
return;
}
if ( index > excluded_box.count() - 1 ) {
index = excluded_box.count() - 1;
}
excluded_box.item( index )->setSelected( true );
}

Expand All @@ -138,6 +144,12 @@ void creator::dual_list_box::exclude_selected()
}
included_box.clear();
included_box.addItems( included );
if( included.isEmpty() ) {
return;
}
if( index > included_box.count() - 1 ) {
index = included_box.count() - 1;
}
included_box.item( index )->setSelected( true );
}

Expand All @@ -149,3 +161,21 @@ QStringList creator::dual_list_box::get_included() const
}
return ret;
}

void creator::dual_list_box::set_included( const QStringList ret )
{
if( included_box.count() > 0 ){
exclude_all();
}
for( int y = 0; y < ret.count(); y++ ) {

for( int i = 0; i < excluded_box.count(); i++ ) {
const QString excluded_single = excluded_box.item( i )->text();
if( excluded_single == ret[y] ) {
excluded_box.item( i )->setSelected( true );
break;
}
}
include_selected();
}
}
1 change: 1 addition & 0 deletions object_creator/dual_list_box.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class dual_list_box : public QWidget

void initialize( const QStringList &items );
void resize( const QSize & );
void set_included( const QStringList ret );

QStringList get_included() const;
Q_SIGNALS:
Expand Down
Loading

0 comments on commit ba775d7

Please sign in to comment.