Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide columns #1026

Closed
4 of 13 tasks
eevleevs opened this issue May 28, 2017 · 15 comments
Closed
4 of 13 tasks

Hide columns #1026

eevleevs opened this issue May 28, 2017 · 15 comments
Assignees
Labels
enhancement Feature requests.

Comments

@eevleevs
Copy link

eevleevs commented May 28, 2017

Details for the issue

I often use a db instead of a spreadsheet, and I would use the possibility to hide columns in order to focus only on certain fields. Views don't seem a solution to this because they cannot edit data.

I'm opening this issue because:

  • DB4S is crashing
  • DB4S has a bug
  • DB4S needs a feature
  • DB4S has another problem

I'm using DB4S on:

  • Windows: ( version: ___ )
  • Linux: ( distro: ___ )
  • Mac OS: ( version: ___ )
  • Other: ___

I'm using DB4S version:

  • 3.9.1
  • 3.9.0
  • Other: ___

I have also:

@justinclift justinclift added the enhancement Feature requests. label May 28, 2017
@justinclift
Copy link
Member

Interesting thought. Yep, it does sound like it would be useful. 😄

@chrisjlocke
Copy link
Member

chrisjlocke commented May 28, 2017

A possible 'temporary workaround' is that columns can be resized down to quite a small size.
image

These can also be saved if the database is saved as a 'project', which is handy...
So not perfect, but 'workable'.... ;)

Maybe if the minimum size could be removed or made smaller?

@justinclift
Copy link
Member

Yep, that'd probably work too. 😄

@iKlsR
Copy link
Member

iKlsR commented May 28, 2017

How would one go about showing back the hidden column, do we want to selectively hide columns and then have a mass show all hidden? Or maybe put them in a list?

@eevleevs
Copy link
Author

Mass show works for me, if you want to make it simple.
For hiding, would be good if one could select several columns, and hide all at once.

@iKlsR iKlsR self-assigned this Jun 13, 2017
@lpirl
Copy link

lpirl commented Jun 15, 2017

for references, resolving #141 (edit views) would resolve this issue as well

@peteristhegreat
Copy link
Contributor

I implemented this feature recently on 3.9.0. I'll see if I can put together a git pull request soon. The corner case for if all columns gets hidden, it unhides the first column (not the zeroth).

// Add two actions in MainWindow.ui called "actionHideColumns" and "actionShowAllColumns"

// add two lines to MainWindow::init()

popupBrowseDataHeaderMenu->addAction(ui->actionHideColumns);
popupBrowseDataHeaderMenu->addAction(ui->actionShowAllColumns);

// add two slots to MainWindow.cpp
void MainWindow::on_actionHideColumns_triggered()
{
     int myCol = -1;
     if(ui->dataTable->selectedCols().size() == 0)
     {
          myCol = ui->actionBrowseTableEditDisplayFormat->property("clicked_column").toInt();
     }

     foreach(int col, ui->dataTable->selectedCols())
     {
          ui->dataTable->hideColumn(col);
     }
     if(myCol != -1)
          ui->dataTable->hideColumn(myCol);

     // check to see if all the columns are hidden

     bool allHidden = true;
     for(int col = 1; col < ui->dataTable->model()->columnCount(); col++)
     {
          if(!ui->dataTable->isColumnHidden(col))
          {
                allHidden = false;
                break;
          }
     }

     if(allHidden  && ui->dataTable->model()->columnCount() > 1)
     {
          ui->dataTable->showColumn(1);
          ui->dataTable->resizeColumnToContents(1);
     }
}

void MainWindow::on_actionShowAllColumns_triggered()
{
     for(int col = 1; col < ui->dataTable->model()->columnCount(); col++)
     {
          if(ui->dataTable->isColumnHidden(col))
          {
                ui->dataTable->showColumn(col);
                ui->dataTable->resizeColumnToContents(col);
          }
     }
}

@justinclift
Copy link
Member

@peteristhegreat Cool. Yep, please get that info a PR when you have a few minutes. 😄

@peteristhegreat
Copy link
Contributor

Built and tested on Qt 5.6.1, MingW 4.9.2 32bit.

See #1135

demo_hide_cols_before

demo_hide_cols_after

@justinclift
Copy link
Member

Thanks @peteristhegreat, just saw the PR. The placement of the options looks good to me. Right-click context menu being where people generally expect this kind of thing. 😄

@MKleusberg
Copy link
Member

@eevleevs We've just added this feature to our code. Are you interested in downloading tomorrow's nightly build and testing if it works for you? 😄 Thanks again to @peteristhegreat for implementing this!

@eevleevs
Copy link
Author

Works perfectly, thank you 👍

@justinclift
Copy link
Member

Awesome, thanks for verifying @eevleevs. 😄

@KimlongSeng
Copy link

Is there a way to hide it until I turn it back on ? So far, when I click refresh, it will reappear.

@MKleusberg
Copy link
Member

@KimlongSeng Which version are you using? And can you try again with the latest nightly build from here? In theory it should stay hidden in that version.

@pete165 pete165 mentioned this issue Aug 12, 2023
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests.
Projects
None yet
Development

No branches or pull requests

8 participants