小编amr*_*ree的帖子

Place button group at the far right side of a header with Bootstrap

I've managed to place a button group at the far side of a header (H1/H2/H3). However, I don't know how to make the button float vertically in the middle. It just stays at the top. I tried using margin-top but since it's a fixed value it won't be dynamically placed in the middle.

Here's the screenshot:

enter image description here

Here's the code:

<div class="container">
  <section>
    <div class="page-header">
      <h1 class="pull-left">
        The header
      </h1>
      <div class="pull-right">
        <div class="btn-group">
          <button class="btn btn-primary">
            Actions
          </button>
          <button class="btn …
Run Code Online (Sandbox Code Playgroud)

css twitter-bootstrap

55
推荐指数
2
解决办法
8万
查看次数

如何确保QTableView中的列调整为最大值

我不知道怎么问这个问题,所以,请随时询问更多信息.

似乎tableView->resizeColumnsToContents()只会根据当前视图中的数据调整所有列的大小.这意味着如果我有更多的数据(在单词数量方面更长),这些单词将被包装(如果wordWrap属性设置为true).

奇怪的是,如果我向下滚动到底部并刷新数据,tableView将正确调整这些列的大小.好像tableView不知道下面有更长的文字.

所以,我的问题是,如何根据所有数据确保将这些列调整为最大值?

我的代码

QSqlTableModel *model = new QSqlTableModel;
model->setTable("item");
model->setEditStrategy(QSqlTableModel::OnManualSubmit);
model->select();    
tableResult->setModel(model);    
tableResult->setEditTriggers(QAbstractItemView::NoEditTriggers);    
tableResult->setSelectionBehavior(QAbstractItemView::SelectRows);
tableResult->setSelectionMode(QAbstractItemView::SingleSelection);    
tableResult->resizeColumnsToContents();
tableResult->resizeRowsToContents();
Run Code Online (Sandbox Code Playgroud)

更新1

我试过了tableResult->scrollToBottom(),它只会根据底部的项目调整大小.所以,如果中间有较长的单词,那些单词就会被包裹起来.

更新2

如果有人想了解我在说什么,请下载此示例.您将看到单击PushButton将生成未正确调整大小的数据.

更新3

可能是一个错误:https://bugreports.qt.io/browse/QTBUG-9352

qt qtableview

28
推荐指数
3
解决办法
4万
查看次数

MySQL日期时间索引不起作用

表结构:

+-------------+----------+------+-----+---------+----------------+
| Field       | Type     | Null | Key | Default | Extra          |
+-------------+----------+------+-----+---------+----------------+
| id          | int(11)  | NO   | PRI | NULL    | auto_increment |
| total       | int(11)  | YES  |     | NULL    |                |
| thedatetime | datetime | YES  | MUL | NULL    |                |
+-------------+----------+------+-----+---------+----------------+
Run Code Online (Sandbox Code Playgroud)

总行数:137967

mysql> explain select * from out where thedatetime <= NOW();
+----+-------------+-------------+------+---------------+------+---------+------+--------+-------------+
| id | select_type | table       | type | possible_keys | key  | key_len …
Run Code Online (Sandbox Code Playgroud)

mysql database-design

13
推荐指数
2
解决办法
1万
查看次数

整数常量上的后缀"-252"无效

我一直在尝试从https://github.com/amree/mykad-c/blob/master/scdump.c运行一个C文件,但我一直Invalid suffix "-252" on integer constant在这部分代码:

        if (RxBuffer[0x11E-252] == 'P')
            printf("Female\n");
        else if (RxBuffer[0x11E-252] == 'L')
            printf("Male\n");
        else
            printf("%c\n", RxBuffer[0x11E-252]);
Run Code Online (Sandbox Code Playgroud)

我很确定它的语法相关.但我真的不懂代码(我正在尝试,但我几乎被卡住).谁能帮我?

c integer

8
推荐指数
2
解决办法
2217
查看次数

使用 Docker 打开带有 Rails 功能规范的 Chrome

我不知道在 Docker 中运行 Rails 的非无头功能规范时如何使功能规范发挥作用。我可以打开 Chrome,但我得到了ERR_EMPTY_RESPONSE (基本上,它是空白的)

完整源代码可在以下位置获取:https://github.com/amree/blog-example

命令:

# chromedriver on the host
chromedriver --whitelisted-ips

# build the image
docker build -t blog_base --progress=plain --secret id=bundle_credentials,src=.env.development .

# run the test
docker compose run --rm web bundle exec rspec spec/features/user_creates_post_spec.rb
Run Code Online (Sandbox Code Playgroud)
# chromedriver on the host
chromedriver --whitelisted-ips

# build the image
docker build -t blog_base --progress=plain --secret id=bundle_credentials,src=.env.development .

# run the test
docker compose run --rm web bundle exec rspec spec/features/user_creates_post_spec.rb
Run Code Online (Sandbox Code Playgroud)
# Dockerfile
FROM ruby:2.6.3

RUN …
Run Code Online (Sandbox Code Playgroud)

selenium ruby-on-rails selenium-chromedriver docker

5
推荐指数
1
解决办法
1037
查看次数

重置Qt样式表

我设法将我的QLineEdit设置为这样的样式:

替代文字http://www.kimag.es/share/54278758.png

void Utilities::setFormErrorStyle(QLineEdit *lineEdit)
{
    lineEdit->setStyleSheet(
            "background-color: #FF8A8A;"
            "background-image: url(:/resources/warning.png);"
            "background-position: right center;"
            "background-repeat: no-repeat;"
            "");
}
Run Code Online (Sandbox Code Playgroud)

我用这个函数调用了

Utilities *util = new Utilities;
util->setFormErrorStyle(lineNoStaf);
Run Code Online (Sandbox Code Playgroud)

流程应该是这样的:

  1. 用户打开表单
  2. 用户填写数据
  3. 用户提交数据
  4. 得到了错误
  5. 使用 setFormErrorStyle()
  6. 用户编辑QLineEdit中的文本,样式消失

此功能应该可以一遍又一遍地重复使用,但是如何将QLineEdit信号连接textChanged()到其他类中的功能,该功能将重置样式表,然后断开信号,使其在每次文本更改时都不会连续运行?

qt stylesheet signals-slots

2
推荐指数
1
解决办法
7282
查看次数

Zend Framework中的SHA1过滤器

如何使用Zend Filter将我的POST数据过滤为SHA1值?我正在尝试将用户提交的当前普通密码与我数据库中的SHA1值进行比较.

我正在使用Identical Validator来比较值(在将表单呈现给用户之前从数据库中获取的值).我processAjax用来验证所有表单值.

php zend-framework

1
推荐指数
1
解决办法
1388
查看次数