Listing line number of results in `find` and `ls`

3,861

Solution 1

You can use the following command:

ls | nl

Solution 2

"cat -n" will add line numbers. E.g.: ls | cat -n

Share:
3,861

Related videos on Youtube

Sadık
Author by

Sadık

Updated on September 18, 2022

Comments

  • Sadık
    Sadık over 1 year

    When using a QToolButton and the setDefaultAction(myAction) method, it will get the default actions properties

    Reference:

    If a tool button has a default action, the action defines the button's properties like text, icon, tool tip, etc.

    So I try to overwrite the icon, calling setIcon on the QToolButton.

    myAction.setIcon(...);
    myToolButton->setDefaultAction(myAction);
    myToolButton->setIcon(...);
    

    But it myToolButton still has the Icon of myAction.

    Is there a way to hold the default action but overwrite it's icon, only for the QToolButton, not for the action itself? In otherwords: How can the QToolButtons have different properties than its default action?

    • Pavel Strakhov
      Pavel Strakhov over 9 years
      Overwriting icon using setIcon perfectly works, at least in Qt 5.2. What is your Qt version?
    • Admin
      Admin over 8 years
      eh, same solution, but somewhat different problem
    • Admin
      Admin over 8 years
      Not if you see the problem for what it is: "Run some command and get line numbers in output"
    • Admin
      Admin over 8 years
      but how would i go about finding that thread given my question, ie how did you find it?
    • Admin
      Admin over 8 years
      Googled line number output site:unix.stackexchange.com (it was the last result on the first page.) The Stack Exchange site search is notoriously bad, Googling with a site restriction often yields better results.
    • Admin
      Admin over 8 years
      eh ok, i'll accept that
  • Andrew Dolby
    Andrew Dolby over 9 years
    The reference docs you linked were for Qt 4.8, so I checked the source for 4.8. It's got the same use of setIcon(action->icon()). Could you post a more complete code example? I've tested using setDefaultAction then setIcon, and it's working for me. I'll post an example if you'd like to take a look.
  • Sadık
    Sadık over 9 years
    your code works for me. However my code doesn't and I don't understand why. Anyhow, it seems that I have another problem here.
  • cfye14
    cfye14 over 8 years
    Thx. Can't upvote but what I'm looking for.
  • cfye14
    cfye14 over 8 years
    what i'm looking for, thx. probably could find this but my google query was awkward, i think.