我使用react,react-router和material-ui-next开始一个新项目。
我面临着一个我试图找不到的问题。
table exceeds containing component boundaries
结构是这样的
return (
<Paper>
<Fragment>
<CommonToolbar reload={getAnns} />
<Typography variant="title">Announces</Typography>
<Table className={classes.table}>
<TableHead>
样式以这种方式定义
const styles = {
root: {
flexGrow: 1,
padding: 10,
margin: 10
},
flex: {
flex: 1,
},
input: {
marginRight: 10
},
select: {
marginRight: 10
}
}
我想要实现的是屏幕上包含的一个表格,如果它超出了屏幕,则该表格应该是水平可滚动的,但始终包含在Paper Component中。
任何提示都将受到赞赏。感谢
此致
答案 0 :(得分:1)
您可以尝试在纸制容器中添加#ifndef TIPMANAGER_H
#define TIPMANAGER_H
#include <QWidget>
namespace Ui {
class TipManager;
}
class TipManager : public QWidget
{
Q_OBJECT
public:
explicit TipManager(QWidget *parent = 0);
~TipManager();
bool eventFilter(QObject *watched, QEvent *event);
private:
Ui::TipManager *ui;
};
#endif // TIPMANAGER_H
吗?
JSX:
#include "tipmanager.h"
#include "ui_tipmanager.h"
#include <QKeyEvent>
#include <QTextEdit>
#include <QDebug>
TipManager::TipManager(QWidget *parent) :
QWidget(parent),
ui(new Ui::TipManager)
{
ui->setupUi(this);
ui->codeTextEdit->installEventFilter(this);
}
TipManager::~TipManager()
{
delete ui;
}
bool TipManager::eventFilter(QObject *watched, QEvent *event)
{
if(watched == ui->codeTextEdit && event->type() == QEvent::KeyPress){
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
qDebug()<<keyEvent->key();
}
return QWidget::eventFilter(watched, event);
}
您的样式:
overflowX: "auto"